New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alertmanager: add missing types #5876
alertmanager: add missing types #5876
Conversation
alertmanager v0.26 introduced some new types in receiver configuration Fixes prometheus-operator#5857
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! We need to sanitize the inputs based on the Alertmanager version. See an example here:
prometheus-operator/pkg/alertmanager/amcfg.go
Lines 1949 to 1967 in fa1893b
func (voc *victorOpsConfig) sanitize(amVersion semver.Version, logger log.Logger) error { | |
if err := voc.HTTPConfig.sanitize(amVersion, logger); err != nil { | |
return err | |
} | |
if voc.APIKeyFile != "" && amVersion.LT(semver.MustParse("0.25.0")) { | |
msg := "'api_key_file' supported in Alertmanager >= 0.25.0 only - dropping field from provided config" | |
level.Warn(logger).Log("msg", msg, "current_version", amVersion.String()) | |
voc.APIKeyFile = "" | |
} | |
if voc.APIKey != "" && voc.APIKeyFile != "" { | |
msg := "'api_key' and 'api_key_file' are mutually exclusive for victorops receiver config - 'api_url' has taken precedence" | |
level.Warn(logger).Log("msg", msg) | |
voc.APIKeyFile = "" | |
} | |
return nil | |
} |
Thank you for the hint i will try to implement it |
alertmanager v0.26 introduced some new types in receiver configuration
add input sanitize and unit test for new alertmanager types Telegram: bot_token_file Webhook: url_file Pushover: user_key_file and token_file fix: prometheus-operator#5857
For telegramConfigs I have added it in #5882 |
ok than i remove the config from this PR. |
The telegram bot_token_file is already handle in prometheus-operator#5882
@simonpasquier @slashpai can someone have a look please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
alertmanager v0.26 introduced some new types in receiver configuration
Fixes #5857
Description
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
x
in the box that apply.CHANGE
(fix or feature that would cause existing functionality to not work as expected)FEATURE
(non-breaking change which adds functionality)BUGFIX
(non-breaking change which fixes an issue)ENHANCEMENT
(non-breaking change which improves existing functionality)NONE
(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.