Skip to content

Commit

Permalink
feat: add ability to pass custom labels (#244)
Browse files Browse the repository at this point in the history
* add ability to pass custom labels

* update comment

* simplify template for labels
  • Loading branch information
diamonwiggins authored Feb 4, 2025
1 parent 3eb7c66 commit 267678f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ helm.sh/chart: {{ include "replicated.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}

{{/*
Pod Labels
*/}}
{{- define "replicated.podLabels" -}}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}

{{/*
Expand Down
1 change: 1 addition & 0 deletions chart/templates/replicated-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ spec:
checksum/replicated-secret: {{ include (print $.Template.BasePath "/replicated-secret.yaml") . | sha256sum }}
labels:
{{- include "replicated.labels" . | nindent 8 }}
{{- include "replicated.podLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
9 changes: 9 additions & 0 deletions chart/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
global:
imageRegistry: ""

# Additional labels to add to all resources created by this chart
commonLabels: {}
# app.kubernetes.io/part-of: my-app
# environment: production

# Deprecated: Use .Values.image instead of .Values.images
# The following properties for the Replicated SDK image are deprecated:
#
Expand Down Expand Up @@ -47,6 +52,10 @@ containerSecurityContext:
capabilities:
drop: ["ALL"]

# Additional labels to add to the pod template
podLabels: {}
# example.com/custom-label: value

podSecurityContext:
enabled: true
runAsUser: 1001
Expand Down

0 comments on commit 267678f

Please sign in to comment.