Skip to content

Commit caae400

Browse files
jmckulktjmoore4
authored andcommitted
Allow user to provide pod labels via values.yaml
Users can now provide custom pod labels through the values.yaml file. Any labels that overlap with Crunchy labels will lead to duplicate labels on the resource and errors returned from the Kube API when creating the templated resource.
1 parent d26278a commit caae400

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

helm/install/templates/_helpers.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
2525
app.kubernetes.io/managed-by: {{ .Release.Service }}
2626
{{- end }}
2727

28+
{{/*
29+
Custom Labels
30+
*/}}
31+
{{- define "install.customPodLabels" -}}
32+
{{- if .Values.customPodLabels -}}
33+
{{ toYaml .Values.customPodLabels }}
34+
{{- end}}
35+
{{- end }}
36+
2837
{{/*
2938
Create the name of the service account to use
3039
*/}}

helm/install/templates/manager.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ spec:
1616
metadata:
1717
labels:
1818
{{- include "install.clusterLabels" . | nindent 8 }}
19+
{{- include "install.customPodLabels" . | nindent 8 }}
1920
spec:
2021
{{- include "install.imagePullSecrets" . | indent 6 }}
2122
serviceAccountName: {{ include "install.serviceAccountName" . }}

helm/install/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ imagePullSecretNames: []
4444
# Resource configuration of the PostgresCluster and PGUpgrade controllers.
4545
resources:
4646
controller: {}
47+
48+
# Define custom labels for PGO pods
49+
# Note: Defining labels that overlap with any Crunchy Data label, for example,
50+
# postgres-operator.crunchydata.com, will cause an error
51+
# customPodLabels:
52+
# example.com: custom-label

0 commit comments

Comments
 (0)