-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix: One Alertmanager Config failing blocks all others. #6585
base: main
Are you sure you want to change the base?
Fix: One Alertmanager Config failing blocks all others. #6585
Conversation
@codeknight03 seen youe commits, i think this will resolve the issue, as the invalid URLs can be detected now before generating configFile, Can you write the unit tests for this, for confirmation. |
return err | ||
} | ||
if _, err := validation.ValidateURL(strings.TrimSpace(url)); err != nil { | ||
return fmt.Errorf("discord webhook 'url' %s invalid: %w", url, err) |
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.
The error from ValidateURL() already contains the URL value. Also since we treat the URL as a secret, we shouldn't log it and we'd need a ValidateSecretURL() function.
return fmt.Errorf("discord webhook 'url' %s invalid: %w", url, err) | |
return err |
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.
we'd need a ValidateSecretURL() function
You mean we'd need to define a new ValidateSecretURL() function? Why? I thought we already got the URL string from GetSecretKey() in the previous line, so ValidateURL() is enough? 🤔
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.
It's because ValidateURL()
would return the URL value in the error which isn't something you want for a "secret" URL.
I took a look at this. Here's what I see:
|
Thanks @haanhvu for the comments. Yes I agree that we'd need unit tests to validate the fix. |
Description
We need to validate the urls passed as secrets in AlertManagerConfig receivers ( Slack and Discord in particular) to ensure we discard the faulty config early and don't create a hang up at the conversion stage.
Closes #6532
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.)Verification
Build the image and try passing a malformed url in slack config for which the operator logs show error.
Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.