Skip to content

chore(base-cluster/monitoring): adjust metrics syntax#1562

Merged
cwrau merged 1 commit intomainfrom
chore/base-cluster/change-flux-alert-syntax
Jul 29, 2025
Merged

chore(base-cluster/monitoring): adjust metrics syntax#1562
cwrau merged 1 commit intomainfrom
chore/base-cluster/change-flux-alert-syntax

Conversation

@cwrau
Copy link
Copy Markdown
Member

@cwrau cwrau commented Jul 8, 2025

Summary by CodeRabbit

  • Chores
    • Updated label names in monitoring and alerting configurations for improved consistency. No changes to alert logic or metric collection.

Copilot AI review requested due to automatic review settings July 8, 2025 13:12
@cwrau cwrau enabled auto-merge July 8, 2025 13:12
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 8, 2025

Walkthrough

Label keys in Prometheus alert rules and kube-state-metrics configuration were renamed from exported_namespace and name to customresource_namespace and customresource_name. This affects both metric extraction and alert message templating, but does not alter any logic, resource paths, or alert conditions.

Changes

File(s) Change Summary
charts/base-cluster/templates/flux/rules/flux-status.yaml Renamed alert rule label keys and template variables from exported_namespace/name to customresource_namespace/customresource_name.
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_kube-state-metrics-config.yaml Updated metric label extraction keys from exported_namespace/name to customresource_namespace/customresource_name.

Possibly related PRs

Suggested labels

base-cluster

Suggested reviewers

  • marvinWolff
  • teutonet-bot
  • tasches

Poem

In the cluster’s gentle breeze,
Labels shift with nimble ease—
Names and namespaces, now anew,
Custom-crafted, clear in view.
Metrics smile, alerts align,
Prometheus pings, “All is fine!”
🐇✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/name to customresource_namespace/customresource_name in 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_namespace and name labels to reflect the new customresource_namespace and customresource_name keys.
                    "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_namespace and name are also updated to use customresource_namespace and customresource_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_namespace and customresource_name labels correctly.
                    )

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 for customresource_kind

The label rename in annotations and PromQL selectors is consistent with the metric changes.
One thing to verify: customresource_kind is 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 explicit customresource_kind in labelsFromPath for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 856d649 and 583ea25.

📒 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

@teutonet-bot
Copy link
Copy Markdown
Contributor

🤖 I have diffed this beep boop

"/$namespace/$kind/$name.yaml" for normal resources
"/$namespace/HelmRelease/$name/$namespace/$kind/$name.yaml" for HelmReleases <- this is recursive
'null' means it's either cluster-scoped or it's in the default namespace for the HelmRelease

charts/base-cluster/ci/monitoring-ingress-unauthenticated-values.yaml

charts/base-cluster/ci/rbac-values.yaml

charts/base-cluster/ci/pagerduty-values.yaml

charts/base-cluster/ci/velero-backupStorageLocations-gen-values.yaml

charts/base-cluster/ci/flux-gitrepositories-gen-values.yaml

charts/base-cluster/ci/traefik-ingress-values.yaml

charts/base-cluster/ci/imagepullsecrets-values.yaml

charts/base-cluster/values.yaml

charts/base-cluster/ci/artifacthub-values.yaml

charts/base-cluster/ci/disabled-ingress-values.yaml

charts/base-cluster/ci/priorityclasses-values.yaml

[charts/base-cluster/ci/deadmansswitch-values.yaml](

<title> Error </title> <script src="https://unpkg.com/htmx.org@2.0.2" integrity="sha384-Y7hw+L/jvKeWIRRkqWYfPcvVxHzVzn5REgzbawhxAuQGwX1XWe70vji+VSeHOThJ" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script defer src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script> <script defer src="https://static.dpaste.com/static/pastebin/js/base.js"></script> <script defer>
    </script>
    <style></style>
    
    
</head>

<body hx-on:keydown="var path=window.location.pathname; if ((event.key=='n' || event.key=='N') && path && path !== '/' && !path.includes('/duplicate/') && !path.includes('/dashboard') && !path.includes('/accounts') && !path.includes('/properties')) { window.location.href = '/'; }">
    <div id="container">
        
        <div class="topbuttons">
            
                <a href="/accounts/login/"
                   title="Personal dashboard, preferences, API token"
                   class="button"><b>Sign in</b></a>
            
            <a href="/" title="Create a new paste (shortcut: 'N')" class=" button">New</a>
            <a href="/api/v2/"
               title="Paste creation API, with code samples"
               class=" activebutton  button">API</a>
            <a href="/help/"
               title="Usage tips, shortcuts"
               class="  button">Help</a>
            <a href="/about/"
               title="Updates, stats, backstory"
               class=" button">About</a>
        </div>
        
<div class="error">
    <h3>Sorry!</h3>
    Sorry, maximum content size is 1,000,000 bytes. Your submission is 2552278 bytes. Your IP will be blocked if you exceed this limit again in the next 60 seconds.
    <hr>
    <p>
        Something unexpected? Please create a <a href="https://dpaste.freshdesk.com/support/tickets/new">support ticket</a>.
    </p>
</div>
<p>
    <a class="button" href="{$ url 'create' %}" onclick="history.back();return false;">Go back</a>
</p>

    </div>
    
    
    <script>
        window.fwSettings={'widget_id':22000000180 };
        !function(){if("function"!=typeof window.FreshworksWidget){var n=function(){n.q.push(arguments)};n.q=[],window.FreshworksWidget=n}}();
    </script>
    <script defer src='https://widget.freshworks.com/widgets/22000000180.js'></script>
</body>
)

charts/base-cluster/ci/monitoring-oidc-values.yaml

charts/base-cluster/ci/basic-values.yaml

charts/base-cluster/ci/monitoring-oidc-ingress-disabled-values.yaml

charts/base-cluster/ci/rbac-emails-values.yaml

charts/base-cluster/ci/limitrange-resourcequota-values.yaml

@cwrau cwrau added this pull request to the merge queue Jul 29, 2025
Merged via the queue into main with commit ebc2d74 Jul 29, 2025
41 of 42 checks passed
@cwrau cwrau deleted the chore/base-cluster/change-flux-alert-syntax branch July 29, 2025 09:38
github-merge-queue Bot pushed a commit that referenced this pull request Jul 31, 2025
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants