@@ -45,13 +45,20 @@ Create chart name and version as used by the chart label.
4545
4646{{/*
4747Common labels
48+ Includes standard Kubernetes recommended labels, selector labels,
49+ and user-defined commonLabels. Note: commonLabels are rendered here
50+ (not in selectorLabels) to avoid adding mutable labels to immutable
51+ selector matchLabels.
4852*/ }}
4953{{- define " controlplane.labels" -}}
5054{{ $version := .Values.image.version | default .Chart.AppVersion -}}
5155helm.sh /chart: {{ include " controlplane.chart" . }}
5256{{ include " controlplane.selectorLabels" . }}
5357app.kubernetes.io /version: {{ $version | quote }}
5458app.kubernetes.io /managed-by: {{ .Release.Service }}
59+ {{- range $key , $value := .Values.commonLabels }}
60+ {{ $key }}: {{ quote $value }}
61+ {{- end }}
5562{{- end }}
5663
5764{{/*
@@ -72,13 +79,13 @@ extra labels (jobLabels) to each job
7279
7380{{/*
7481Selector labels
82+ Used in spec.selector.matchLabels which are immutable after creation.
83+ Only include stable, deterministic labels here -- do not add commonLabels
84+ or other user-configurable values.
7585*/ }}
7686{{- define " controlplane.selectorLabels" -}}
7787app.kubernetes.io /name: {{ include " controlplane.name" . }}
7888app.kubernetes.io /instance: {{ .Release.Name }}
79- {{- range $key , $value := .Values.commonLabels }}
80- {{ $key }}: {{ quote $value }}
81- {{- end }}
8289{{- end }}
8390
8491{{/*
0 commit comments