Skip to content

Commit 931a47a

Browse files
committed
feat: add commonLabels and podLabels support
Add `commonLabels` and `podLabels` values for injecting custom labels into chart resources. - `commonLabels` — merged into `chart.labels`, applied to all resource metadata (StatefulSet, Service, Ingress, test Jobs) - `podLabels` — applied to pod template labels alongside chart.labels (does not affect `spec.selector.matchLabels`) This is a common pattern in the Helm ecosystem (see metrics-server, ingress-nginx, cert-manager) that enables operators to apply organizational labels without forking or wrapping the chart.
1 parent e75846c commit 931a47a

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

charts/chromadb-chart/templates/_helpers.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ helm.sh/chart: {{ include "chart.chart" . }}
4040
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4141
{{- end }}
4242
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- with .Values.commonLabels }}
44+
{{ toYaml . }}
45+
{{- end }}
4346
{{- end }}
4447

4548
{{/*

charts/chromadb-chart/templates/statefulset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ spec:
1616
metadata:
1717
labels:
1818
{{- include "chart.labels" . | nindent 8 }}
19+
{{- with .Values.podLabels }}
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
1922
annotations:
2023
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} # Automatically Roll Deployments
2124
{{- with .Values.podSpec.podAnnotations }}

charts/chromadb-chart/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ imagePullSecrets: [ ]
1515
nameOverride: ""
1616
fullnameOverride: ""
1717

18+
# Additional labels applied to all chart resources (e.g., for org-wide labeling)
19+
commonLabels: {}
20+
21+
# Additional labels applied to pods only (e.g., for pod-level selection or monitoring)
22+
podLabels: {}
23+
1824
serviceAccount:
1925
# Specifies whether a service account should be created
2026
create: true

0 commit comments

Comments
 (0)