[kube-prometheus-stack] skip disabled single-rule groups#6905
Merged
jkroepke merged 1 commit intoMay 17, 2026
Merged
Conversation
fca9207 to
6b3519c
Compare
1049bab to
f89c15b
Compare
Contributor
Author
|
Hi maintainers, could someone review this when available? It avoids rendering invalid PrometheusRule objects with rules: null when the single-alert controller-manager/kube-proxy/scheduler groups are disabled. I validated the disabled and enabled render paths with helm template/helm lint; I’m happy to adjust the unittest coverage or generated sync changes if you prefer a different pattern. Thanks. |
f89c15b to
98a1f94
Compare
Contributor
Author
|
@jkroepke Rebased on the latest |
3cc3fd2 to
436f280
Compare
Signed-off-by: Zakhar Dvurechensky <72825626+Zakharden@users.noreply.github.com>
436f280 to
1a3b4eb
Compare
jkroepke
approved these changes
May 17, 2026
Member
|
Thanks |
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
Skips rendering the three generated single-alert PrometheusRule groups when their only alert is disabled via
defaultRules.disabled.With Helm 4, disabling
KubeControllerManagerDown,KubeProxyDown, orKubeSchedulerDowncurrently leaves a rendered PrometheusRule withspec.groups[].rules: null, which Kubernetes rejects becauserulesmust be an array. Since each affected group contains only that one alert, omitting the whole group avoids rendering invalid resources while preserving the default behavior when the alerts are enabled.The generated templates and
hack/sync_prometheus_rules.pyare updated together so future rule syncs keep the same guards.Which issue this PR fixes
Special notes for your reviewer
I added a focused helm-unittest case for the disabled single-rule groups. I could not run it locally because the
helm unittestplugin is not installed in this environment, but the rendered chart was validated withhelm templateandhelm lint.Validation
helm template test charts/kube-prometheus-stack --kube-version 1.35.4 --set defaultRules.disabled.KubeControllerManagerDown=true --set defaultRules.disabled.KubeProxyDown=true --set defaultRules.disabled.KubeSchedulerDown=true --set grafana.enabled=false --set kubeStateMetrics.enabled=false --set nodeExporter.enabled=false --set windowsMonitoring.enabled=false > /tmp/kps-disabled-rules.yamlrg -n "kubernetes-system-(kube-proxy|controller-manager|scheduler)" /tmp/kps-disabled-rules.yaml(no matches)helm template test charts/kube-prometheus-stack --kube-version 1.35.4 --show-only templates/prometheus/rules-1.14/kubernetes-system-kube-proxy.yaml --show-only templates/prometheus/rules-1.14/kubernetes-system-controller-manager.yaml --show-only templates/prometheus/rules-1.14/kubernetes-system-scheduler.yamlhelm lint charts/kube-prometheus-stack --kube-version 1.35.4helm lint charts/kube-prometheus-stack --kube-version 1.35.4 --set defaultRules.disabled.KubeControllerManagerDown=true --set defaultRules.disabled.KubeProxyDown=true --set defaultRules.disabled.KubeSchedulerDown=true --set grafana.enabled=false --set kubeStateMetrics.enabled=false --set nodeExporter.enabled=false --set windowsMonitoring.enabled=falsegit diff --checkChecklist
[prometheus-couchdb-exporter])