← Back to Pull requests

[helm][kuberay-operator] Don't emit empty ServiceMonitor labels; rename selector -> additionalLabels #4979

Closed
unknown closed this pull request without merging on Jul 07, 2026 03:48 UTC
View on GitHub
unknown unknown commented on Jul 07, 2026 01:16 UTC
Author

Why are these changes needed?

Two fixes to helm-chart/kuberay-operator/templates/servicemonitor.yaml:

1. Don't emit an empty labels: block

The template unconditionally rendered a labels: key:

  labels:
    {{- with .Values.metrics.serviceMonitor.selector }}
      {{- toYaml . | nindent 4 }}
    {{- end }}

With the default (empty) value, this produced an empty metadata.labels, which doesn't match what Kubernetes actually stores on the object. As a result ArgoCD reports the ServiceMonitor as OutOfSync. The labels: key is now wrapped in {{- with }} so it's only emitted when labels are actually configured.

2. Rename selector → additionalLabels

.Values.metrics.serviceMonitor.selector populates the ServiceMonitor's metadata.labels — it is not a selector. The name was confusing because:

  • It sets labels, not a selector.

  • It collided conceptually with the template's real spec.selector (which selects the Service to scrape).
  • The value exists so that Prometheus can discover this ServiceMonitor via its serviceMonitorSelector (e.g. release: prometheus for kube-prometheus-stack). additionalLabels matches the convention used by other charts (e.g. kube-prometheus-stack) and describes what the field actually does.

    [!WARNING]

    Breaking change: users setting metrics.serviceMonitor.selector must switch to metrics.serviceMonitor.additionalLabels. Happy to instead keep selector as a deprecated fallback for one release if reviewers prefer a non-breaking path.

    Related issue number

    <!-- For example: "Closes #1234" -->

    Checks

    values.yaml and the helm-docs-generated README.md row were updated to match. Verified with helm lint (passes) and helm template:

  • ServiceMonitor enabled, no additionalLabels → no labels: key rendered.

  • ServiceMonitor enabled, additionalLabels.release=prometheus → metadata.labels.release: prometheus rendered.
  • 🤖 Generated with Claude Code

    Diff: 251 lines (+188 / -63) across 3 files Reviewer: Future-Outlier Review duration: 151m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.62) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 251 lines diff across 3 files
    0.62
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.331
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #4979"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.2% (MEDIUM) · Higher = larger blast radius
    62.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.9% · Safe to merge
    26.9%