From 3512922ac93cd16dbad87ae703f8fad837db780a Mon Sep 17 00:00:00 2001 From: Burak Karakan Date: Fri, 13 May 2022 00:24:48 +0100 Subject: [PATCH] feat: copy dags from the mounted pvc to the local dag path Signed-off-by: Burak Karakan --- .../files/pod_template.kubernetes-helm-yaml | 6 ++++- charts/airflow/templates/_helpers/pods.tpl | 23 +++++++++++++++++-- .../db-migrations-deployment.yaml | 6 ++++- .../db-migrations/db-migrations-job.yaml | 6 ++++- .../templates/flower/flower-deployment.yaml | 6 ++++- .../scheduler/scheduler-deployment.yaml | 7 +++++- .../sync/sync-connections-deployment.yaml | 6 ++++- .../templates/sync/sync-connections-job.yaml | 6 ++++- .../templates/sync/sync-pools-deployment.yaml | 6 ++++- .../templates/sync/sync-pools-job.yaml | 6 ++++- .../templates/sync/sync-users-deployment.yaml | 6 ++++- .../templates/sync/sync-users-job.yaml | 6 ++++- .../sync/sync-variables-deployment.yaml | 6 ++++- .../templates/sync/sync-variables-job.yaml | 6 ++++- .../triggerer/triggerer-deployment.yaml | 7 +++++- .../webserver/webserver-deployment.yaml | 7 +++++- .../templates/worker/worker-statefulset.yaml | 6 ++++- 17 files changed, 104 insertions(+), 18 deletions(-) diff --git a/charts/airflow/files/pod_template.kubernetes-helm-yaml b/charts/airflow/files/pod_template.kubernetes-helm-yaml index 2b3fa888..b27f765b 100644 --- a/charts/airflow/files/pod_template.kubernetes-helm-yaml +++ b/charts/airflow/files/pod_template.kubernetes-helm-yaml @@ -48,9 +48,13 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 4 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 4 }} + {{- else }} {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 4 }} {{- end }} + {{- end }} {{- if .Values.airflow.kubernetesPodTemplate.extraInitContainers }} {{- toYaml .Values.airflow.kubernetesPodTemplate.extraInitContainers | nindent 4 }} {{- end }} diff --git a/charts/airflow/templates/_helpers/pods.tpl b/charts/airflow/templates/_helpers/pods.tpl index 1ad83253..3bd923b9 100644 --- a/charts/airflow/templates/_helpers/pods.tpl +++ b/charts/airflow/templates/_helpers/pods.tpl @@ -254,8 +254,6 @@ EXAMPLE USAGE: {{ include "airflow.container.git_sync" (dict "Release" .Release name: {{ .Values.dags.gitSync.httpSecret }} key: {{ .Values.dags.gitSync.httpSecretPasswordKey }} {{- end }} - {{- /* this has user-defined variables, so must be included BELOW (so the ABOVE `env` take precedence) */ -}} - {{- include "airflow.env" . | indent 4 }} volumeMounts: - name: dags-data mountPath: /dags @@ -273,6 +271,27 @@ EXAMPLE USAGE: {{ include "airflow.container.git_sync" (dict "Release" .Release {{- end }} {{- end }} +{{/* +Define a container which copies the contents of the DAG PVC to the DAG directory in the pod +EXAMPLE USAGE: {{ include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) }} +*/}} +{{- define "airflow.container.dag_pvc_copy" }} +- name: dags-copy-from-pvc + image: busybox:1.35 + imagePullPolicy: Never + securityContext: + runAsUser: {{ .Values.dags.gitSync.image.uid }} + runAsGroup: {{ .Values.dags.gitSync.image.gid }} + volumeMounts: + - name: dags-data + mountPath: /dags + command: + - "cp" + - "-r" + - "/dags" + - {{ .Values.dags.path }} +{{- end }} + {{/* Define a container which regularly deletes airflow logs older than a retention period. EXAMPLE USAGE: {{ include "airflow.container.log_cleanup" (dict "Release" .Release "Values" .Values "resources" $lc_resources "retention_min" $lc_retention_min "interval_sec" $lc_interval_sec) }} diff --git a/charts/airflow/templates/db-migrations/db-migrations-deployment.yaml b/charts/airflow/templates/db-migrations/db-migrations-deployment.yaml index 48018eaf..8aba39e1 100644 --- a/charts/airflow/templates/db-migrations/db-migrations-deployment.yaml +++ b/charts/airflow/templates/db-migrations/db-migrations-deployment.yaml @@ -82,10 +82,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: - name: db-migrations diff --git a/charts/airflow/templates/db-migrations/db-migrations-job.yaml b/charts/airflow/templates/db-migrations/db-migrations-job.yaml index 0f646d2a..81e93814 100644 --- a/charts/airflow/templates/db-migrations/db-migrations-job.yaml +++ b/charts/airflow/templates/db-migrations/db-migrations-job.yaml @@ -76,10 +76,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: - name: db-migrations diff --git a/charts/airflow/templates/flower/flower-deployment.yaml b/charts/airflow/templates/flower/flower-deployment.yaml index 1ea72d77..dbf88653 100644 --- a/charts/airflow/templates/flower/flower-deployment.yaml +++ b/charts/airflow/templates/flower/flower-deployment.yaml @@ -86,10 +86,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/scheduler/scheduler-deployment.yaml b/charts/airflow/templates/scheduler/scheduler-deployment.yaml index 5527e870..ecdbe656 100644 --- a/charts/airflow/templates/scheduler/scheduler-deployment.yaml +++ b/charts/airflow/templates/scheduler/scheduler-deployment.yaml @@ -94,9 +94,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} + ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- if .Values.scheduler.extraInitContainers }} diff --git a/charts/airflow/templates/sync/sync-connections-deployment.yaml b/charts/airflow/templates/sync/sync-connections-deployment.yaml index a90111e8..57431beb 100644 --- a/charts/airflow/templates/sync/sync-connections-deployment.yaml +++ b/charts/airflow/templates/sync/sync-connections-deployment.yaml @@ -82,10 +82,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-connections-job.yaml b/charts/airflow/templates/sync/sync-connections-job.yaml index 7f6ec176..1a344d40 100644 --- a/charts/airflow/templates/sync/sync-connections-job.yaml +++ b/charts/airflow/templates/sync/sync-connections-job.yaml @@ -76,10 +76,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-pools-deployment.yaml b/charts/airflow/templates/sync/sync-pools-deployment.yaml index 81aeca61..a4ac484c 100644 --- a/charts/airflow/templates/sync/sync-pools-deployment.yaml +++ b/charts/airflow/templates/sync/sync-pools-deployment.yaml @@ -82,10 +82,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-pools-job.yaml b/charts/airflow/templates/sync/sync-pools-job.yaml index 72b7c24d..72e5f978 100644 --- a/charts/airflow/templates/sync/sync-pools-job.yaml +++ b/charts/airflow/templates/sync/sync-pools-job.yaml @@ -76,10 +76,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-users-deployment.yaml b/charts/airflow/templates/sync/sync-users-deployment.yaml index a9d43a9f..0bce843a 100644 --- a/charts/airflow/templates/sync/sync-users-deployment.yaml +++ b/charts/airflow/templates/sync/sync-users-deployment.yaml @@ -82,10 +82,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-users-job.yaml b/charts/airflow/templates/sync/sync-users-job.yaml index bb3b2153..896765d7 100644 --- a/charts/airflow/templates/sync/sync-users-job.yaml +++ b/charts/airflow/templates/sync/sync-users-job.yaml @@ -76,10 +76,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-variables-deployment.yaml b/charts/airflow/templates/sync/sync-variables-deployment.yaml index 4be64441..6d583f68 100644 --- a/charts/airflow/templates/sync/sync-variables-deployment.yaml +++ b/charts/airflow/templates/sync/sync-variables-deployment.yaml @@ -82,10 +82,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/sync/sync-variables-job.yaml b/charts/airflow/templates/sync/sync-variables-job.yaml index 919a4582..40a58525 100644 --- a/charts/airflow/templates/sync/sync-variables-job.yaml +++ b/charts/airflow/templates/sync/sync-variables-job.yaml @@ -76,10 +76,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/triggerer/triggerer-deployment.yaml b/charts/airflow/templates/triggerer/triggerer-deployment.yaml index f8d8a1af..b6f2de99 100644 --- a/charts/airflow/templates/triggerer/triggerer-deployment.yaml +++ b/charts/airflow/templates/triggerer/triggerer-deployment.yaml @@ -86,9 +86,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} + ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/webserver/webserver-deployment.yaml b/charts/airflow/templates/webserver/webserver-deployment.yaml index ac2af3e9..a0d07644 100644 --- a/charts/airflow/templates/webserver/webserver-deployment.yaml +++ b/charts/airflow/templates/webserver/webserver-deployment.yaml @@ -86,9 +86,14 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} + ## git-sync is included so "airflow plugins" & "python packages" can be stored in the dags repo {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: diff --git a/charts/airflow/templates/worker/worker-statefulset.yaml b/charts/airflow/templates/worker/worker-statefulset.yaml index 17735fa0..c5553a77 100644 --- a/charts/airflow/templates/worker/worker-statefulset.yaml +++ b/charts/airflow/templates/worker/worker-statefulset.yaml @@ -91,9 +91,13 @@ spec: {{- if $extraPipPackages }} {{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} {{- end }} - {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} + {{- if .Values.dags.gitSync.enabled }} + {{- if .Values.dags.persistence.enabled }} + {{- include "airflow.container.dag_pvc_copy" (dict "Release" .Release "Values" .Values) | indent 8 }} + {{- else }} {{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} {{- end }} + {{- end }} {{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} {{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} containers: