Skip to content

fix(helm): make Hubble ServiceMonitor target configurable - #2620

Open
Abdulla Zin (abdullazin) wants to merge 5 commits into
microsoft:mainfrom
slariviere:fix/hubble-servicemonitor-selector-port
Open

fix(helm): make Hubble ServiceMonitor target configurable#2620
Abdulla Zin (abdullazin) wants to merge 5 commits into
microsoft:mainfrom
slariviere:fix/hubble-servicemonitor-selector-port

Conversation

@abdullazin

@abdullazin Abdulla Zin (abdullazin) commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Adds supported configuration for the Hubble metrics ServiceMonitor without changing its existing rendered default selector, port, or namespace.

Problem

The Hubble metrics ServiceMonitor currently reads .Values.prometheus.serviceMonitor.namespace, but that values path is not declared in this chart. Enabling hubble.metrics.serviceMonitor.enabled therefore fails Helm rendering with a nil-pointer error.

Deployments that use Retina's network-observability metrics Service also need a way to configure the ServiceMonitor's selector labels and target port. That Service uses k8s-app: networkobservability and named port hubble, unlike the chart's current default ServiceMonitor target.

Changes

  • Add hubble.metrics.serviceMonitor.namespace, defaulting to the release namespace.
  • Add hubble.metrics.serviceMonitor.selectorLabels and port as supported configuration values.
  • Preserve existing defaults exactly: k8s-app: hubble and hubble-metrics.

This is backward-compatible for existing values: an enabled ServiceMonitor renders the same selector, port, and namespace as before, except that it now renders successfully without an undeclared prometheus values map. Retina deployments can opt in to their network-observability Service by overriding the new selector and port values.

Validation

  • helm lint . passes.
  • Default render with hubble.metrics.serviceMonitor.enabled=true retains k8s-app: hubble, port hubble-metrics, and the release namespace.
  • Render with namespace=metrics-monitoring, selectorLabels.k8s-app=networkobservability, and port=hubble produces the requested cross-namespace ServiceMonitor.

Related to #1872

…-service

The hubble/servicemonitor.yaml template has three mismatches with the
network-observability Service defined in hubble/metrics-service.yaml:

1. Namespace: references .Values.prometheus.serviceMonitor.namespace which is
   not defined in the chart values, causing a nil pointer panic when
   hubble.metrics.serviceMonitor.enabled is set to true.

2. Selector: uses k8s-app: hubble but the network-observability Service is
   labelled k8s-app: networkobservability.

3. Port name: targets hubble-metrics but the Service port is named hubble.

These issues mean that enabling the Hubble metrics ServiceMonitor either
crashes helm template or produces a resource that never discovers the Service,
leaving Hubble pod-level metrics (hubble_drop_total, hubble_dns_queries_total,
hubble_flows_processed_total, etc.) unscraped.

Also updates app.kubernetes.io/part-of from cilium to retina since this is
the Retina chart, not Cilium.

Signed-off-by: Abdulla Zin <Abdulla.Zin@goto.com>
Signed-off-by: Abdulla Zin <abdulla.zin@goto.com>
Signed-off-by: Abdulla Zin <abdulla.zin@goto.com>
Signed-off-by: Abdulla Zin <abdulla.zin@goto.com>
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.

1 participant