From 17195da0d49ba76f01506bb2305e0dc3fd438378 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Mon, 4 May 2026 13:31:05 -0400 Subject: [PATCH] fix: use otel selector labels instead of regular labels for proper trace wiring --- charts/ctrlplane/Chart.lock | 6 +-- charts/ctrlplane/Chart.yaml | 2 +- charts/ctrlplane/charts/otel/Chart.yaml | 2 +- .../charts/otel/templates/daemonset.yaml | 3 +- .../charts/otel/templates/deployment.yaml | 3 +- .../charts/otel/templates/service.yaml | 2 +- .../ctrlplane/tests/otel_selector_test.yaml | 54 +++++++++++++++++++ 7 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 charts/ctrlplane/tests/otel_selector_test.yaml diff --git a/charts/ctrlplane/Chart.lock b/charts/ctrlplane/Chart.lock index 7a2fb9e..63ada8a 100644 --- a/charts/ctrlplane/Chart.lock +++ b/charts/ctrlplane/Chart.lock @@ -4,7 +4,7 @@ dependencies: version: 0.1.6 - name: otel repository: file://charts/otel - version: 0.2.0 + version: 0.2.1 - name: wandb-base repository: https://charts.wandb.ai version: 0.11.11 @@ -14,5 +14,5 @@ dependencies: - name: wandb-base repository: https://charts.wandb.ai version: 0.11.11 -digest: sha256:11be9c366718847a7f76355f54f3816cd7223e2d9feb63a28d90e6397ad0cc50 -generated: "2026-04-13T16:19:18.331308-05:00" +digest: sha256:03b431cdd1b20c20d969b0eacb90e33dec92599d877dde63f801f2fa926b8d86 +generated: "2026-05-04T13:22:49.464936-04:00" diff --git a/charts/ctrlplane/Chart.yaml b/charts/ctrlplane/Chart.yaml index 378ea0b..c1bb90b 100644 --- a/charts/ctrlplane/Chart.yaml +++ b/charts/ctrlplane/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: ctrlplane description: Ctrlplane Helm chart for Kubernetes type: application -version: 1.1.1 +version: 1.1.2 appVersion: 1.0.0 maintainers: diff --git a/charts/ctrlplane/charts/otel/Chart.yaml b/charts/ctrlplane/charts/otel/Chart.yaml index 3e1571a..69f0d48 100644 --- a/charts/ctrlplane/charts/otel/Chart.yaml +++ b/charts/ctrlplane/charts/otel/Chart.yaml @@ -3,5 +3,5 @@ name: otel type: application description: A Helm chart for Kubernetes -version: 0.2.0 +version: 0.2.1 appVersion: "0.109.0" diff --git a/charts/ctrlplane/charts/otel/templates/daemonset.yaml b/charts/ctrlplane/charts/otel/templates/daemonset.yaml index a9f9a46..f0997b2 100644 --- a/charts/ctrlplane/charts/otel/templates/daemonset.yaml +++ b/charts/ctrlplane/charts/otel/templates/daemonset.yaml @@ -15,8 +15,7 @@ metadata: spec: selector: matchLabels: - {{- include "ctrlplane.selectorLabels" $ | nindent 6 }} - {{- include "otel.labels" . | nindent 6 }} + {{- include "otel.selectorLabels" . | nindent 6 }} template: {{ include "otel.podTemplate" . }} {{- end }} diff --git a/charts/ctrlplane/charts/otel/templates/deployment.yaml b/charts/ctrlplane/charts/otel/templates/deployment.yaml index a2251d2..a720774 100644 --- a/charts/ctrlplane/charts/otel/templates/deployment.yaml +++ b/charts/ctrlplane/charts/otel/templates/deployment.yaml @@ -22,8 +22,7 @@ spec: {{- end }} selector: matchLabels: - {{- include "ctrlplane.selectorLabels" $ | nindent 6 }} - {{- include "otel.labels" . | nindent 6 }} + {{- include "otel.selectorLabels" . | nindent 6 }} template: {{ include "otel.podTemplate" . }} {{- end }} diff --git a/charts/ctrlplane/charts/otel/templates/service.yaml b/charts/ctrlplane/charts/otel/templates/service.yaml index 55231b6..7e58ce3 100644 --- a/charts/ctrlplane/charts/otel/templates/service.yaml +++ b/charts/ctrlplane/charts/otel/templates/service.yaml @@ -32,4 +32,4 @@ spec: protocol: TCP name: otlp-http selector: - {{- include "otel.labels" . | nindent 4 }} \ No newline at end of file + {{- include "otel.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/ctrlplane/tests/otel_selector_test.yaml b/charts/ctrlplane/tests/otel_selector_test.yaml new file mode 100644 index 0000000..416cc76 --- /dev/null +++ b/charts/ctrlplane/tests/otel_selector_test.yaml @@ -0,0 +1,54 @@ +suite: otel selectors are stable across chart versions +templates: + - charts/otel/templates/daemonset.yaml + - charts/otel/templates/deployment.yaml + - charts/otel/templates/service.yaml + - charts/otel/templates/configmap.yaml +release: + name: ctrlplane + +tests: + - it: daemonset selector contains only stable identity labels + template: charts/otel/templates/daemonset.yaml + asserts: + - equal: + path: spec.selector.matchLabels + value: + app.kubernetes.io/name: otel + app.kubernetes.io/instance: ctrlplane + + - it: daemonset pod labels still include chart-version labels + template: charts/otel/templates/daemonset.yaml + asserts: + - equal: + path: spec.template.metadata.labels["app.kubernetes.io/name"] + value: otel + - equal: + path: spec.template.metadata.labels["app.kubernetes.io/instance"] + value: ctrlplane + - exists: + path: spec.template.metadata.labels["helm.sh/chart"] + - exists: + path: spec.template.metadata.labels["ctrlplane.com/app-name"] + + - it: deployment selector contains only stable identity labels + template: charts/otel/templates/deployment.yaml + set: + otel: + workload: + kind: Deployment + asserts: + - equal: + path: spec.selector.matchLabels + value: + app.kubernetes.io/name: otel + app.kubernetes.io/instance: ctrlplane + + - it: service selector contains only stable identity labels + template: charts/otel/templates/service.yaml + asserts: + - equal: + path: spec.selector + value: + app.kubernetes.io/name: otel + app.kubernetes.io/instance: ctrlplane