diff --git a/examples/chart/teleport-kube-agent/templates/delete_hook.yaml b/examples/chart/teleport-kube-agent/templates/delete_hook.yaml index 3690ae754e780..f0a4b2edf6b06 100644 --- a/examples/chart/teleport-kube-agent/templates/delete_hook.yaml +++ b/examples/chart/teleport-kube-agent/templates/delete_hook.yaml @@ -73,6 +73,15 @@ spec: template: metadata: name: {{ .Release.Name }}-delete-hook +{{- if .Values.annotations.pod }} + annotations: + {{- toYaml .Values.annotations.pod | nindent 8 }} +{{- end }} + labels: + app: {{ .Release.Name }} +{{- if .Values.extraLabels.pod }} + {{- toYaml .Values.extraLabels.pod | nindent 8 }} +{{- end }} spec: {{- if .Values.imagePullSecrets }} imagePullSecrets: diff --git a/examples/chart/teleport-kube-agent/templates/hook.yaml b/examples/chart/teleport-kube-agent/templates/hook.yaml index e6d7de50a80f6..3a2f13e98e8f1 100644 --- a/examples/chart/teleport-kube-agent/templates/hook.yaml +++ b/examples/chart/teleport-kube-agent/templates/hook.yaml @@ -63,6 +63,15 @@ spec: template: metadata: name: {{ .Release.Name }}-hook +{{- if .Values.annotations.pod }} + annotations: + {{- toYaml .Values.annotations.pod | nindent 8 }} +{{- end }} + labels: + app: {{ .Release.Name }} +{{- if .Values.extraLabels.pod }} + {{- toYaml .Values.extraLabels.pod | nindent 8 }} +{{- end }} spec: {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} diff --git a/examples/chart/teleport-kube-agent/tests/__snapshot__/job_test.yaml.snap b/examples/chart/teleport-kube-agent/tests/__snapshot__/job_test.yaml.snap index 762a93b19a32b..2c4750e59cac5 100644 --- a/examples/chart/teleport-kube-agent/tests/__snapshot__/job_test.yaml.snap +++ b/examples/chart/teleport-kube-agent/tests/__snapshot__/job_test.yaml.snap @@ -89,6 +89,8 @@ should not create ServiceAccount for post-delete hook if serviceAccount.create i spec: template: metadata: + labels: + app: RELEASE-NAME name: RELEASE-NAME-delete-hook spec: containers: diff --git a/examples/chart/teleport-kube-agent/tests/job_test.yaml b/examples/chart/teleport-kube-agent/tests/job_test.yaml index 5496b1d4df066..6f430f7e276f8 100644 --- a/examples/chart/teleport-kube-agent/tests/job_test.yaml +++ b/examples/chart/teleport-kube-agent/tests/job_test.yaml @@ -258,3 +258,20 @@ tests: apiVersion: rbac.authorization.k8s.io/v1 - matchSnapshot: path: spec.template.spec + + - it: should contain pod labels in the Job's pod spec if extraLabels.pod is set + template: delete_hook.yaml + # documentIndex: 0=ServiceAccount 1=Role 2=RoleBinding 3=Job + documentIndex: 3 + values: + - ../.lint/backwards-compatibility.yaml + set: + extraLabels: + pod: + testLabel: testValue + asserts: + - equal: + path: spec.template.metadata.labels + value: + app: RELEASE-NAME + testLabel: testValue diff --git a/examples/chart/teleport-kube-agent/values.yaml b/examples/chart/teleport-kube-agent/values.yaml index cbac339a279b8..c607fc33ddbc5 100644 --- a/examples/chart/teleport-kube-agent/values.yaml +++ b/examples/chart/teleport-kube-agent/values.yaml @@ -405,7 +405,7 @@ extraLabels: deployment: {} # Labels to set on the post-delete Job created by the chart. job: {} - # Labels for each Pod in the Deployment/StatefulSet + # Labels for each Pod in the Deployment, StatefulSet, or Job pod: {} # Labels for the Pod Disruption Budget (ignored when disabled) podDisruptionBudget: {}