Skip to content

[prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy#6713

Open
firasmosbehi wants to merge 1 commit intoprometheus-community:mainfrom
firasmosbehi:codex/6640-blackbox-networkpolicy-namespace-label
Open

[prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy#6713
firasmosbehi wants to merge 1 commit intoprometheus-community:mainfrom
firasmosbehi:codex/6640-blackbox-networkpolicy-namespace-label

Conversation

@firasmosbehi
Copy link
Copy Markdown
Contributor

Summary

This PR updates prometheus-blackbox-exporter network policy namespace matching to use Kubernetes' well-known namespace label and addresses #6640.

Problem

When networkPolicy.allowMonitoringNamespace is enabled, the chart currently matches on name=<namespace>. In many environments, deployers do not control namespace labels and cannot guarantee a custom name label exists.

Root cause

templates/networkpolicy.yaml hardcodes the namespace selector key to name.

Fix

  • Switched namespace selector label key from name to kubernetes.io/metadata.name.
  • Updated values comment to describe the new expected label semantics.
  • Bumped chart version from 11.8.0 to 11.8.1.

Validation

  • helm lint charts/prometheus-blackbox-exporter
  • helm template test charts/prometheus-blackbox-exporter --set networkPolicy.enabled=true --set networkPolicy.allowMonitoringNamespace=true --set networkPolicy.monitoringNamespaceName=observability
  • Verified rendered selector contains kubernetes.io/metadata.name: observability.

Notes

This keeps the same user-facing value (monitoringNamespaceName) while aligning selector behavior with a standard Kubernetes label.

…Policy

Signed-off-by: Firas Mosbehi <firas.mosbehi@insat.ucar.tn>
@firasmosbehi firasmosbehi changed the title [codex] [prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy [prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy Mar 6, 2026
@firasmosbehi firasmosbehi changed the title [prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy [codex] [prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy Mar 6, 2026
@firasmosbehi firasmosbehi marked this pull request as ready for review March 6, 2026 09:44
@firasmosbehi firasmosbehi changed the title [codex] [prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy [prometheus-blackbox-exporter] use kubernetes.io/metadata.name in networkPolicy Mar 6, 2026
- namespaceSelector:
matchLabels:
name: {{ .Values.networkPolicy.monitoringNamespaceName }}
kubernetes.io/metadata.name: {{ .Values.networkPolicy.monitoringNamespaceName }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As this is changing the current default behaviour i consider this a breaking change.
Therefore major version of the chart woul dneed an update.
Maybe make key and value configurable so the current default can be kept.

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