Skip to content

examples: "changing-default-rules" doesn't remove all kubernetesControlPlane prometheusRules.#2718

Merged
simonpasquier merged 1 commit intoprometheus-operator:mainfrom
kivikakk:push-vxwvsqtmlrrt
Aug 25, 2025
Merged

examples: "changing-default-rules" doesn't remove all kubernetesControlPlane prometheusRules.#2718
simonpasquier merged 1 commit intoprometheus-operator:mainfrom
kivikakk:push-vxwvsqtmlrrt

Conversation

@kivikakk
Copy link
Copy Markdown
Contributor

The prometheusRule+:: was overriding the visibility, causing no output.

Description

examples/changing-default-rules.libsonnet uses prometheusRule+::, but this changes the visibility of the field used to actually expose the created PrometheusRule objects. See:

prometheusRule: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'PrometheusRule',
metadata: k8s._metadata {
name: 'kubernetes-monitoring-rules',
labels+: k8s._config.mixin.ruleLabels,
},
spec: {
local r = if std.objectHasAll(k8s.mixin, 'prometheusRules') then k8s.mixin.prometheusRules.groups else [],
local a = if std.objectHasAll(k8s.mixin, 'prometheusAlerts') then k8s.mixin.prometheusAlerts.groups else [],
groups: a + r,
},
},

Using prometheusRule+: instead works as expected.

Type of change

What type of changes does your code introduce to the kube-prometheus? 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.)

Changelog entry

Please put a one-line changelog entry below. Later this will be copied to the changelog file.

- Correct `changing-default-rules.libsonnet` example's override of `kubernetesControlPlane.prometheusRule`'s visibility.

The :: was overriding the visibility, causing no output.
@kivikakk kivikakk requested a review from a team as a code owner August 23, 2025 04:52
Copy link
Copy Markdown
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

Thanks!

@simonpasquier simonpasquier merged commit 11ab511 into prometheus-operator:main Aug 25, 2025
11 checks passed
@kivikakk kivikakk deleted the push-vxwvsqtmlrrt branch August 25, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants