Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14] Adding extra pod labels to post-upgrade and post-delete hook job pods #46236

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/chart/teleport-kube-agent/templates/delete_hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions examples/chart/teleport-kube-agent/templates/hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions examples/chart/teleport-kube-agent/tests/job_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/chart/teleport-kube-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down
Loading