From 096feab07073ad81ffb2182e3c0d352bdc583827 Mon Sep 17 00:00:00 2001 From: aakcht Date: Mon, 1 May 2023 15:31:39 +0300 Subject: [PATCH] Chart: add custom volumemounts to dag processor waitForMigrations --- .../dag-processor/dag-processor-deployment.yaml | 9 ++++++++- tests/charts/airflow_core/test_dag_processor.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml index 4f8b84284e4cb..d556da7bae717 100644 --- a/chart/templates/dag-processor/dag-processor-deployment.yaml +++ b/chart/templates/dag-processor/dag-processor-deployment.yaml @@ -115,7 +115,14 @@ spec: resources: {{- toYaml .Values.dagProcessor.resources | nindent 12 }} image: {{ template "airflow_image_for_migrations" . }} imagePullPolicy: {{ .Values.images.airflow.pullPolicy }} - volumeMounts: {{- include "airflow_config_mount" . | nindent 12 }} + volumeMounts: + {{- if .Values.volumeMounts }} + {{- toYaml .Values.volumeMounts | nindent 12 }} + {{- end }} + {{- if .Values.dagProcessor.extraVolumeMounts }} + {{- toYaml .Values.dagProcessor.extraVolumeMounts | nindent 12 }} + {{- end }} + {{- include "airflow_config_mount" . | nindent 12 }} args: {{- include "wait-for-migrations-command" . | indent 10 }} envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }} env: diff --git a/tests/charts/airflow_core/test_dag_processor.py b/tests/charts/airflow_core/test_dag_processor.py index def2523fc2874..2b59cc0c34e2c 100644 --- a/tests/charts/airflow_core/test_dag_processor.py +++ b/tests/charts/airflow_core/test_dag_processor.py @@ -118,6 +118,9 @@ def test_should_add_extra_volume_and_extra_volume_mount(self): assert "test-volume" == jmespath.search( "spec.template.spec.containers[0].volumeMounts[0].name", docs[0] ) + assert "test-volume" == jmespath.search( + "spec.template.spec.initContainers[0].volumeMounts[0].name", docs[0] + ) def test_should_add_global_volume_and_global_volume_mount(self): docs = render_chart( @@ -133,6 +136,9 @@ def test_should_add_global_volume_and_global_volume_mount(self): assert "test-volume" == jmespath.search( "spec.template.spec.containers[0].volumeMounts[0].name", docs[0] ) + assert "test-volume" == jmespath.search( + "spec.template.spec.initContainers[0].volumeMounts[0].name", docs[0] + ) def test_should_add_extraEnvs(self): docs = render_chart(