Skip to content
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

Merged
merged 6 commits into from Sep 11, 2023

Conversation

HaveFun83
Copy link
Contributor

@HaveFun83 HaveFun83 commented Sep 1, 2023

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.

add missing types introduced in alertmanager v0.26

alertmanager v0.26 introduced some new types in receiver configuration

Fixes prometheus-operator#5857
@HaveFun83 HaveFun83 requested a review from a team as a code owner September 1, 2023 12:13
Copy link
Contributor

@simonpasquier simonpasquier left a 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:

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
}

@HaveFun83
Copy link
Contributor Author

HaveFun83 commented Sep 1, 2023

Thank you for the hint i will try to implement it

Hendrik Ferber added 2 commits September 1, 2023 18:32
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
@pull-request-size pull-request-size bot added size/L and removed size/XS labels Sep 1, 2023
pkg/alertmanager/amcfg.go Outdated Show resolved Hide resolved
@slashpai
Copy link
Contributor

slashpai commented Sep 4, 2023

For telegramConfigs I have added it in #5882

@HaveFun83
Copy link
Contributor Author

For telegramConfigs I have added it in #5882

ok than i remove the config from this PR.

@HaveFun83
Copy link
Contributor Author

@simonpasquier @slashpai can someone have a look please?

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@simonpasquier simonpasquier merged commit cba414f into prometheus-operator:main Sep 11, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[alertmanager] webhook url_file parameter is missing
3 participants