Skip to content
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: 7 additions & 2 deletions chart/files/pod-template-file.kubernetes-helm-yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ metadata:
{{- with .Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- if .Values.airflowPodAnnotations }}
{{- if or .Values.airflowPodAnnotations .Values.workers.podAnnotations }}
annotations:
{{- toYaml .Values.airflowPodAnnotations | nindent 4 }}
{{- if .Values.airflowPodAnnotations }}
{{- toYaml .Values.airflowPodAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.workers.podAnnotations }}
{{- toYaml .Values.workers.podAnnotations | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if or (and .Values.dags.gitSync.enabled (not .Values.dags.persistence.enabled)) .Values.workers.extraInitContainers }}
Expand Down
24 changes: 24 additions & 0 deletions tests/charts/test_pod_template_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,30 @@ def test_airflow_pod_annotations(self):
assert "my_annotation" in annotations
assert "annotated!" in annotations["my_annotation"]

def test_workers_pod_annotations(self):
docs = render_chart(
values={"workers": {"podAnnotations": {"my_annotation": "annotated!"}}},
show_only=["templates/pod-template-file.yaml"],
chart_dir=self.temp_chart_dir,
)
annotations = jmespath.search("metadata.annotations", docs[0])
assert "my_annotation" in annotations
assert "annotated!" in annotations["my_annotation"]

def test_airflow_and_workers_pod_annotations(self):
# should give preference to workers.podAnnotations
docs = render_chart(
values={
"airflowPodAnnotations": {"my_annotation": "airflowPodAnnotations"},
"workers": {"podAnnotations": {"my_annotation": "workerPodAnnotations"}},
},
show_only=["templates/pod-template-file.yaml"],
chart_dir=self.temp_chart_dir,
)
annotations = jmespath.search("metadata.annotations", docs[0])
assert "my_annotation" in annotations
assert "workerPodAnnotations" in annotations["my_annotation"]

def test_should_add_extra_init_containers(self):
docs = render_chart(
values={
Expand Down