Skip to content

Commit

Permalink
add templated field support for extra containers (#38510)
Browse files Browse the repository at this point in the history
  • Loading branch information
romsharon98 authored Mar 31, 2024
1 parent e700f41 commit f6637ee
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.dagProcessor.extraContainers }}
{{- toYaml .Values.dagProcessor.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.dagProcessor.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/flower/flower-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ spec:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "container_extra_envs" (list . .Values.flower.env) | indent 10 }}
{{- if .Values.flower.extraContainers }}
{{- toYaml .Values.flower.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.flower.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/jobs/create-user-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ spec:
{{- tpl (toYaml .Values.createUserJob.extraVolumeMounts) . | nindent 12 }}
{{- end }}
{{- if .Values.createUserJob.extraContainers }}
{{- toYaml .Values.createUserJob.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.createUserJob.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/jobs/migrate-database-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ spec:
{{- tpl (toYaml .Values.migrateDatabaseJob.extraVolumeMounts) . | nindent 12 }}
{{- end }}
{{- if .Values.migrateDatabaseJob.extraContainers }}
{{- toYaml .Values.migrateDatabaseJob.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.migrateDatabaseJob.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/pgbouncer/pgbouncer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ spec:
lifecycle: {{- tpl (toYaml $containerLifecycleHooksMetricsExporter) . | nindent 12 }}
{{- end }}
{{- if .Values.pgbouncer.extraContainers }}
{{- toYaml .Values.pgbouncer.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.pgbouncer.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: pgbouncer-config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.scheduler.extraContainers }}
{{- toYaml .Values.scheduler.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.scheduler.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/triggerer/triggerer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.triggerer.extraContainers }}
{{- toYaml .Values.triggerer.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.triggerer.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/webserver/webserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ spec:
{{- include "git_sync_container" . | nindent 8 }}
{{- end }}
{{- if .Values.webserver.extraContainers }}
{{- toYaml .Values.webserver.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.webserver.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
- name: config
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ spec:
{{- include "standard_airflow_environment" . | indent 10 }}
{{- end }}
{{- if .Values.workers.extraContainers }}
{{- toYaml .Values.workers.extraContainers | nindent 8 }}
{{- tpl (toYaml .Values.workers.extraContainers) . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.volumes }}
Expand Down
4 changes: 2 additions & 2 deletions helm_tests/airflow_aux/test_create_user_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ def test_should_add_extra_containers(self):
values={
"createUserJob": {
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name}}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/jobs/create-user-job.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/airflow_aux/test_migrate_database_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ def test_should_add_extra_containers(self):
values={
"migrateDatabaseJob": {
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/jobs/migrate-database-job.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/airflow_core/test_dag_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ def test_should_add_extra_containers(self):
"dagProcessor": {
"enabled": True,
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/airflow_core/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def test_should_add_extra_containers(self):
"executor": "CeleryExecutor",
"scheduler": {
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/scheduler/scheduler-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/airflow_core/test_triggerer.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ def test_should_add_extra_containers(self):
values={
"triggerer": {
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/triggerer/triggerer-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/airflow_core/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ def test_should_add_extra_containers(self):
"executor": "CeleryExecutor",
"workers": {
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/workers/worker-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/other/test_flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ def test_should_add_extra_containers(self):
"flower": {
"enabled": True,
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/flower/flower-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/other/test_pgbouncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,15 @@ def test_should_add_extra_containers(self):
"pgbouncer": {
"enabled": True,
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{ .Chart.Name }}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down
4 changes: 2 additions & 2 deletions helm_tests/webserver/test_webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ def test_should_add_extra_containers(self):
"executor": "CeleryExecutor",
"webserver": {
"extraContainers": [
{"name": "test-container", "image": "test-registry/test-repo:test-tag"}
{"name": "{{.Chart.Name}}", "image": "test-registry/test-repo:test-tag"}
],
},
},
show_only=["templates/webserver/webserver-deployment.yaml"],
)

assert {
"name": "test-container",
"name": "airflow",
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

Expand Down

0 comments on commit f6637ee

Please sign in to comment.