diff --git a/docs/pages/includes/helm-reference/zz_generated.teleport-kube-agent.mdx b/docs/pages/includes/helm-reference/zz_generated.teleport-kube-agent.mdx index ee6618b05219a..175e6693b56fb 100644 --- a/docs/pages/includes/helm-reference/zz_generated.teleport-kube-agent.mdx +++ b/docs/pages/includes/helm-reference/zz_generated.teleport-kube-agent.mdx @@ -1499,7 +1499,7 @@ for more information. | `object` | `{}` | `extraLabels.pod` are labels to set on the Pods created by the -Deployment or StatefulSet. +Deployment, StatefulSet, or Job. ### `extraLabels.podDisruptionBudget` 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 9e79af11d3538..2b8a67fc94b41 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 @@ -91,6 +91,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 febb020f6d9d4..f694e0644bb8f 100644 --- a/examples/chart/teleport-kube-agent/tests/job_test.yaml +++ b/examples/chart/teleport-kube-agent/tests/job_test.yaml @@ -251,3 +251,21 @@ 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 0af79df0e87a4..beb0d284b1efe 100644 --- a/examples/chart/teleport-kube-agent/values.yaml +++ b/examples/chart/teleport-kube-agent/values.yaml @@ -1120,7 +1120,7 @@ extraLabels: # extraLabels.job(object) -- are labels to set on the post-delete Job created by the chart. job: {} # extraLabels.pod(object) -- are labels to set on the Pods created by the - # Deployment or StatefulSet. + # Deployment, StatefulSet, or Job. pod: {} # extraLabels.podDisruptionBudget(object) -- are labels to set on the podDisruptionBudget. podDisruptionBudget: {}