-
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
Invalid AlertmanagerConfig passes validation and results in 'group_interval cannot be zero' errors #6594
Comments
I missed that it is being validated unlike the case I referenced above but the regex being used is allowing 0 to be taken. The regex is pretty much used for all duration values. Might need to check for what all values the same case might occur. prometheus-operator/pkg/alertmanager/validation/v1alpha1/validation.go Lines 392 to 402 in 48e9858
|
Thanks for the report! We'd need a different regex for durations that can't be zero. |
The fix would be in this regex:
A test case showing that we reject configs that us |
Will be adding a PR ASAP. |
To add to what @ArthurSens said and to expand my earlier comment, the existing pattern is correct for most duration fields except for |
…groupInterval. the existing pattern is correct for most duration fields except for groupInterval and repeatInterval which don't allow "zero" values. In this commitwe define new pattern that rejects "zero" durations. Fixes prometheus-operator#6594 Signed-off-by: alizademhdi <[email protected]>
…groupInterval. the existing pattern is correct for most duration fields except for groupInterval and repeatInterval which don't allow "zero" values. In this commit we define new pattern that rejects "zero" durations. Fixes prometheus-operator#6594 Signed-off-by: alizademhdi <[email protected]>
Is there an existing issue for this?
What happened?
Description
AlertmanagerConfig CR with group_interval set to 0 passes validation and results in errors on the alertmanager instances itself.
ts=2024-05-15T12:04:48.725Z caller=coordinator.go:118 level=error component=configuration msg="Loading configuration file failed" file=/etc/alertmanager/config_out/alertmanager.env.yaml err="group_interval cannot be zero"
Steps to Reproduce
I run the Operator on v0.67.1 (unfortunately the latest kube-prometheus) but the current master CRD seems to references still the same regex.
Expected Result
CR fails validation.
Actual Result
CR passed validation and gets added to the final config file.
Prometheus Operator Version
Kubernetes Version
1.27
Kubernetes Cluster Type
GKE
How did you deploy Prometheus-Operator?
Other (please comment)
Manifests
kube-prometheus jsonnet
prometheus-operator log output
`ts=2024-05-15T12:04:48.725Z caller=coordinator.go:118 level=error component=configuration msg="Loading configuration file failed" file=/etc/alertmanager/config_out/alertmanager.env.yaml err="group_interval cannot be zero"`
Anything else?
No response
The text was updated successfully, but these errors were encountered: