chore(base-cluster/monitoring): adjust metrics syntax#1562
Conversation
WalkthroughLabel keys in Prometheus alert rules and kube-state-metrics configuration were renamed from Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the metrics label keys used in kube-state-metrics configuration and Flux alert rules to a more descriptive naming convention.
- Rename
exported_namespace/nametocustomresource_namespace/customresource_namein kube-state-metrics config - Update Flux alert annotations and expressions to use the new label keys
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| charts/base-cluster/templates/monitoring/kube-prometheus-stack/_kube-state-metrics-config.yaml | Renamed labelsFromPath keys from exported_namespace/name to customresource_namespace/customresource_name |
| charts/base-cluster/templates/flux/rules/flux-status.yaml | Updated alert description and PromQL group-by labels to use customresource_namespace/customresource_name |
Comments suppressed due to low confidence (3)
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_kube-state-metrics-config.yaml:78
- Update any documentation or README that references the old
exported_namespaceandnamelabels to reflect the newcustomresource_namespaceandcustomresource_namekeys.
"customresource_namespace" (list "metadata" "namespace")
charts/base-cluster/templates/flux/rules/flux-status.yaml:21
- Ensure that any dashboards, ServiceMonitors, or downstream queries which previously referenced
exported_namespaceandnameare also updated to usecustomresource_namespaceandcustomresource_name.
description: {{ "Resource {{ $labels.customresource_kind }}/{{ $labels.customresource_namespace }}/{{ $labels.customresource_name }} has been in a failed state for longer than 10 minutes." | quote }}
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_kube-state-metrics-config.yaml:75
- Consider adding or updating tests/validation to verify that kube-state-metrics exports metrics with the new
customresource_namespaceandcustomresource_namelabels correctly.
)
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
charts/base-cluster/templates/flux/rules/flux-status.yaml (1)
21-25: Alert expressions updated; consider verifying metric labels forcustomresource_kindThe label rename in annotations and PromQL selectors is consistent with the metric changes.
One thing to verify:customresource_kindis not set explicitly in the CR metrics block, but kube-state-metrics normally injects it automatically from the GVK. If that behavior ever changes, these alerts would stop firing. You may want to add an explicitcustomresource_kindinlabelsFromPathfor future-proofing.Other than that, the rule logic remains intact. 👍
Also applies to: 31-35
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
charts/base-cluster/templates/flux/rules/flux-status.yaml(1 hunks)charts/base-cluster/templates/monitoring/kube-prometheus-stack/_kube-state-metrics-config.yaml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: check licenses
- GitHub Check: generateDiffCommentBody
- GitHub Check: lint helm chart (base-cluster)
- GitHub Check: wait-for-checks
🤖 I have diffed this beep boop"/$namespace/$kind/$name.yaml" for normal resources
|
🤖 I have created a release *beep* *boop* --- ## [9.1.0](base-cluster-v9.0.0...base-cluster-v9.1.0) (2025-07-31) ### Features * **base-cluster:** use new networkPolicy template ([#1414](#1414)) ([e433c02](e433c02)) ### Bug Fixes * **base-cluster/kyverno:** migrate to new `validationFailureAction` syntax ([#1621](#1621)) ([c3f16be](c3f16be)) * **base-cluster/monitoring:** also create metrics for resources without suspend field ([#1634](#1634)) ([964b34c](964b34c)) * **base-cluster/monitoring:** oauth-proxy serviceMonitor labels ([#1625](#1625)) ([86c1981](86c1981)) * **base-cluster/monitoring:** pin image-renderer version to ensure it's compatible ([#1631](#1631)) ([685592c](685592c)) ### Miscellaneous Chores * **base-cluster/dependencies:** update helm release kube-prometheus-stack to v75.15.1 ([#1610](#1610)) ([256cb8e](256cb8e)) * **base-cluster/dependencies:** update helm release loki to v6.33.0 ([#1618](#1618)) ([7e6a8e8](7e6a8e8)) * **base-cluster/dns:** migrate external-dns away from bitnami ([#1601](#1601)) ([7af34d2](7af34d2)) * **base-cluster/monitoring:** adjust metrics syntax ([#1562](#1562)) ([ebc2d74](ebc2d74)) * **base-cluster/monitoring:** migrate metrics-server away from bitnami ([#1604](#1604)) ([6a755d9](6a755d9)) * **base-cluster:** migrate kubectl image away from bitnami ([#1606](#1606)) ([6fe2410](6fe2410)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a new networkPolicy template in the base-cluster. * **Bug Fixes** * Updated kyverno component to use the latest `validationFailureAction` syntax. * Added metrics for resources in monitoring that lack a suspend field. * Corrected labels in the oauth-proxy serviceMonitor within monitoring. * Pinned image-renderer version to ensure compatibility. * **Chores** * Upgraded helm releases for kube-prometheus-stack and loki. * Migrated external-dns, metrics-server, and kubectl images away from bitnami. * Adjusted metrics syntax in monitoring. * **Documentation** * Added changelog entry for version 9.1.0. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit