From 954ddc4e25a68f413aa5d33ecf387c5a5c233800 Mon Sep 17 00:00:00 2001
From: Nir Rosenthal <32959392+nirroz93@users.noreply.github.com>
Date: Thu, 20 Apr 2023 20:01:26 +0300
Subject: [PATCH 1/6] Template extra volumes in helm chart

same as https://github.com/apache/airflow/pull/29357
---
 chart/templates/workers/worker-deployment.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index bbc57c707fb4f..66d52e4578924 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -149,7 +149,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.workers.extraVolumeMounts }}
-              {{- toYaml .Values.workers.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.workers.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}
@@ -320,7 +320,7 @@ spec:
           {{- toYaml .Values.volumes | nindent 8 }}
         {{- end }}
         {{- if .Values.workers.extraVolumes }}
-          {{- toYaml .Values.workers.extraVolumes | nindent 8 }}
+          {{- tpl (toYaml .Values.workers.extraVolumes) . | nindent 8 }}
         {{- end }}
         - name: config
           configMap:

From 9eaf77ee89fe1720b560f6e67c5f95901d4ba639 Mon Sep 17 00:00:00 2001
From: Nir Rosenthal <nirr@perion.com>
Date: Thu, 20 Apr 2023 21:16:15 +0300
Subject: [PATCH 2/6] tpl extraVolumes and extraVolumeMounts across all
 components

---
 chart/templates/_helpers.yaml                             | 2 +-
 .../templates/dag-processor/dag-processor-deployment.yaml | 4 ++--
 chart/templates/flower/flower-deployment.yaml             | 4 ++--
 chart/templates/jobs/create-user-job.yaml                 | 4 ++--
 chart/templates/pgbouncer/pgbouncer-deployment.yaml       | 4 ++--
 chart/templates/scheduler/scheduler-deployment.yaml       | 4 ++--
 chart/templates/triggerer/triggerer-deployment.yaml       | 8 ++++----
 chart/templates/webserver/webserver-deployment.yaml       | 2 +-
 chart/templates/workers/worker-deployment.yaml            | 6 +++---
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index 5f53076dfcc5e..bdb2a61992390 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -242,7 +242,7 @@ If release name contains chart name it will be used as a full name.
   {{- end }}
   {{- end }}
   {{- if .Values.dags.gitSync.extraVolumeMounts }}
-    {{- toYaml .Values.dags.gitSync.extraVolumeMounts | nindent 2 }}
+    {{- tpl (toYaml .Values.dags.gitSync.extraVolumeMounts) . | nindent 2 }}
   {{- end }}
 {{- end }}
 
diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml
index 964f239e8f4f4..a3acb7def54c2 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -145,7 +145,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.dagProcessor.extraVolumeMounts }}
-              {{ toYaml .Values.dagProcessor.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.dagProcessor.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             - name: logs
               mountPath: {{ template "airflow_logs" . }}
@@ -195,7 +195,7 @@ spec:
           {{- toYaml .Values.volumes | nindent 8 }}
         {{- end }}
         {{- if .Values.dagProcessor.extraVolumes }}
-          {{- toYaml .Values.dagProcessor.extraVolumes | nindent 8 }}
+          {{- tpl (toYaml .Values.dagProcessor.extraVolumes) . | nindent 8 }}
         {{- end }}
         {{- if .Values.logs.persistence.enabled }}
         - name: logs
diff --git a/chart/templates/flower/flower-deployment.yaml b/chart/templates/flower/flower-deployment.yaml
index af86fbd202aa0..4641f652970b6 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -99,7 +99,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.flower.extraVolumeMounts }}
-              {{- toYaml .Values.flower.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.flower.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
           ports:
             - name: flower-ui
@@ -152,7 +152,7 @@ spec:
           {{- toYaml .Values.volumes | nindent 8 }}
         {{- end }}
         {{- if .Values.flower.extraVolumes }}
-          {{- toYaml .Values.flower.extraVolumes | nindent 8 }}
+          {{- tpl (toYaml .Values.flower.extraVolumes) . | nindent 8 }}
         {{- end }}
 {{- end }}
 {{- end }}
diff --git a/chart/templates/jobs/create-user-job.yaml b/chart/templates/jobs/create-user-job.yaml
index 45171eb751109..df37584d6f48d 100644
--- a/chart/templates/jobs/create-user-job.yaml
+++ b/chart/templates/jobs/create-user-job.yaml
@@ -105,7 +105,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.createUserJob.extraVolumeMounts }}
-              {{- toYaml .Values.createUserJob.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.createUserJob.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
         {{- if .Values.createUserJob.extraContainers }}
           {{- toYaml .Values.createUserJob.extraContainers | nindent 8 }}
@@ -118,6 +118,6 @@ spec:
           {{- toYaml .Values.volumes | nindent 8 }}
         {{- end }}
         {{- if .Values.createUserJob.extraVolumes }}
-          {{- toYaml .Values.createUserJob.extraVolumes | nindent 8 }}
+          {{- tpl (toYaml .Values.createUserJob.extraVolumes) . | nindent 8 }}
         {{- end }}
 {{- end }}
diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
index 63c361dc828b5..5a52c193d1369 100644
--- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
@@ -136,7 +136,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.pgbouncer.extraVolumeMounts }}
-              {{- toYaml .Values.pgbouncer.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.pgbouncer.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
           lifecycle:
             preStop:
@@ -185,6 +185,6 @@ spec:
           {{- toYaml .Values.volumes | nindent 8 }}
         {{- end }}
         {{- if .Values.pgbouncer.extraVolumes }}
-          {{- toYaml .Values.pgbouncer.extraVolumes | nindent 8 }}
+          {{- tpl (toYaml .Values.pgbouncer.extraVolumes) . | nindent 8 }}
         {{- end }}
 {{- end }}
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index fbd6180d2864a..5129a783248d6 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -140,7 +140,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.scheduler.extraVolumeMounts }}
-              {{- toYaml .Values.scheduler.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.scheduler.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}
@@ -215,7 +215,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.scheduler.extraVolumeMounts }}
-              {{- toYaml .Values.scheduler.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.scheduler.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
         {{- if and $localOrDagProcessorDisabled .Values.dags.gitSync.enabled }}
           {{- include "git_sync_container" . | indent 8 }}
diff --git a/chart/templates/triggerer/triggerer-deployment.yaml b/chart/templates/triggerer/triggerer-deployment.yaml
index 5ea8e2e7b8181..c2b7e7c082aea 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -128,7 +128,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.triggerer.extraVolumeMounts }}
-              {{- toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.triggerer.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}
@@ -164,7 +164,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.triggerer.extraVolumeMounts }}
-              {{- toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.triggerer.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             - name: logs
               mountPath: {{ template "airflow_logs" . }}
@@ -224,7 +224,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.triggerer.extraVolumeMounts }}
-              {{- toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.triggerer.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}
@@ -257,7 +257,7 @@ spec:
           {{- toYaml .Values.volumes | nindent 8 }}
         {{- end }}
         {{- if .Values.triggerer.extraVolumes }}
-          {{- toYaml .Values.triggerer.extraVolumes | nindent 8 }}
+          {{- tpl (toYaml .Values.triggerer.extraVolumes) . | nindent 8 }}
         {{- end }}
   {{- if .Values.logs.persistence.enabled }}
         - name: logs
diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml
index 03b8b456b4606..b5d2595b3c06d 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -135,7 +135,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.webserver.extraVolumeMounts }}
-              {{- toYaml .Values.webserver.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.webserver.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}
diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index 66d52e4578924..d95c49c714d9b 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -203,7 +203,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.workers.extraVolumeMounts }}
-              {{- toYaml .Values.workers.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.workers.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             - name: logs
               mountPath: {{ template "airflow_logs" . }}
@@ -267,7 +267,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.workers.extraVolumeMounts }}
-              {{- toYaml .Values.workers.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.workers.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}
@@ -298,7 +298,7 @@ spec:
               {{- toYaml .Values.volumeMounts | nindent 12 }}
             {{- end }}
             {{- if .Values.workers.extraVolumeMounts }}
-              {{- toYaml .Values.workers.extraVolumeMounts | nindent 12 }}
+              {{- tpl (toYaml .Values.workers.extraVolumeMounts) . | nindent 12 }}
             {{- end }}
             {{- if or .Values.webserver.webserverConfig .Values.webserver.webserverConfigConfigMapName }}
               {{- include "airflow_webserver_config_mount" . | nindent 12 }}

From 9432ac7b099e302a73231e08a48f461105b2abd5 Mon Sep 17 00:00:00 2001
From: Nir Rosenthal <nirroz93@gmail.com>
Date: Mon, 24 Apr 2023 20:45:16 +0300
Subject: [PATCH 3/6] doc templating same as scheduler and webserver

---
 chart/values.yaml | 70 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 65 insertions(+), 5 deletions(-)

diff --git a/chart/values.yaml b/chart/values.yaml
index 011aff1e8dd16..9079aaf7ed9bf 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -849,7 +849,18 @@ createUserJob:
   # Launch additional containers into user creation job
   extraContainers: []
 
-  # Mount additional volumes into user creation job
+  # Mount additional volumes into user creation job. It can be templated like in the following example:
+  #   extraVolumes:
+  #     - name: my-templated-extra-volume
+  #       secret:
+  #          secretName: '{{ include "my_secret_template" . }}'
+  #          defaultMode: 0640
+  #          optional: true
+  #
+  #   extraVolumeMounts:
+  #     - name: my-templated-extra-volume
+  #       mountPath: "{{ .Values.my_custom_path }}"
+  #       readOnly: true
   extraVolumes: []
   extraVolumeMounts: []
 
@@ -1213,7 +1224,18 @@ triggerer:
   # Add additional init containers into triggerers.
   extraInitContainers: []
 
-  # Mount additional volumes into triggerer.
+  # Mount additional volumes into triggerer. It can be templated like in the following example:
+  #   extraVolumes:
+  #     - name: my-templated-extra-volume
+  #       secret:
+  #          secretName: '{{ include "my_secret_template" . }}'
+  #          defaultMode: 0640
+  #          optional: true
+  #
+  #   extraVolumeMounts:
+  #     - name: my-templated-extra-volume
+  #       mountPath: "{{ .Values.my_custom_path }}"
+  #       readOnly: true
   extraVolumes: []
   extraVolumeMounts: []
 
@@ -1331,7 +1353,18 @@ dagProcessor:
   # Add additional init containers into dag processors.
   extraInitContainers: []
 
-  # Mount additional volumes into dag processor.
+  # Mount additional volumes into dag processor. It can be templated like in the following example:
+  #   extraVolumes:
+  #     - name: my-templated-extra-volume
+  #       secret:
+  #          secretName: '{{ include "my_secret_template" . }}'
+  #          defaultMode: 0640
+  #          optional: true
+  #
+  #   extraVolumeMounts:
+  #     - name: my-templated-extra-volume
+  #       mountPath: "{{ .Values.my_custom_path }}"
+  #       readOnly: true
   extraVolumes: []
   extraVolumeMounts: []
 
@@ -1445,7 +1478,18 @@ flower:
 
   # Launch additional containers into the flower pods.
   extraContainers: []
-  # Mount additional volumes into the flower pods.
+  # Mount additional volumes into the flower pods. It can be templated like in the following example:
+  #   extraVolumes:
+  #     - name: my-templated-extra-volume
+  #       secret:
+  #          secretName: '{{ include "my_secret_template" . }}'
+  #          defaultMode: 0640
+  #          optional: true
+  #
+  #   extraVolumeMounts:
+  #     - name: my-templated-extra-volume
+  #       mountPath: "{{ .Values.my_custom_path }}"
+  #       readOnly: true
   extraVolumes: []
   extraVolumeMounts: []
 
@@ -1632,7 +1676,18 @@ pgbouncer:
   # Add extra general PgBouncer ini configuration: https://www.pgbouncer.org/config.html
   extraIni: ~
 
-  # Mount additional volumes into pgbouncer.
+  # Mount additional volumes into pgbouncer. It can be templated like in the following example:
+  #   extraVolumes:
+  #     - name: my-templated-extra-volume
+  #       secret:
+  #          secretName: '{{ include "my_secret_template" . }}'
+  #          defaultMode: 0640
+  #          optional: true
+  #
+  #   extraVolumeMounts:
+  #     - name: my-templated-extra-volume
+  #       mountPath: "{{ .Values.my_custom_path }}"
+  #       readOnly: true
   extraVolumes: []
   extraVolumeMounts: []
 
@@ -2023,6 +2078,11 @@ dags:
     #  runAsUser: 65533
     #  runAsGroup: 0
 
+  # Mount additional volumes into git-sync. It can be templated like in the following example:
+  #   extraVolumeMounts:
+  #     - name: my-templated-extra-volume
+  #       mountPath: "{{ .Values.my_custom_path }}"
+  #       readOnly: true
     extraVolumeMounts: []
     env: []
     # Supported env vars for gitsync can be found at https://github.com/kubernetes/git-sync

From bf6695524e752b85471a1ba0a146764a3ce03bc3 Mon Sep 17 00:00:00 2001
From: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Date: Fri, 2 Jun 2023 14:41:27 -0600
Subject: [PATCH 4/6] Update chart/values.yaml

---
 chart/values.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chart/values.yaml b/chart/values.yaml
index da74c6a9541dd..bf8c68fd6ef16 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -2201,9 +2201,9 @@ dags:
     #  runAsUser: 65533
     #  runAsGroup: 0
 
-
     securityContexts:
       container: {}
+
    # Mount additional volumes into git-sync. It can be templated like in the following example:
    #   extraVolumeMounts:
    #     - name: my-templated-extra-volume

From e2dd155c2dddd7e82a176d0e5481b83c4b482e54 Mon Sep 17 00:00:00 2001
From: Nir Rosenthal <nirr@perion.com>
Date: Sun, 18 Jun 2023 23:46:28 +0300
Subject: [PATCH 5/6] pass Template to git-sync function as now volumeMounts
 are templated same as every volumeMount

---
 chart/files/pod-template-file.kubernetes-helm-yaml          | 2 +-
 chart/templates/dag-processor/dag-processor-deployment.yaml | 2 +-
 chart/templates/scheduler/scheduler-deployment.yaml         | 2 +-
 chart/templates/triggerer/triggerer-deployment.yaml         | 2 +-
 chart/templates/webserver/webserver-deployment.yaml         | 2 +-
 chart/templates/workers/worker-deployment.yaml              | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml b/chart/files/pod-template-file.kubernetes-helm-yaml
index 3fa53f1e5cc72..1f3dbc909d390 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -47,7 +47,7 @@ spec:
   {{- if or (and .Values.dags.gitSync.enabled (not .Values.dags.persistence.enabled)) .Values.workers.extraInitContainers }}
   initContainers:
     {{- if and .Values.dags.gitSync.enabled (not .Values.dags.persistence.enabled) }}
-      {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 4 }}
+      {{- include "git_sync_container" (dict "Values" .Values "is_init" "true" "Template" .Template) | nindent 4 }}
     {{- end }}
     {{- if .Values.workers.extraInitContainers }}
       {{- toYaml .Values.workers.extraInitContainers | nindent 4 }}
diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml
index 23f827980611d..5515ac4b87d75 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -134,7 +134,7 @@ spec:
             {{- end }}
         {{- end }}
         {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }}
-          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }}
+          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.dagProcessor.extraInitContainers }}
           {{- toYaml .Values.dagProcessor.extraInitContainers | nindent 8 }}
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index 9e256f56511e6..1c752dc00328a 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -161,7 +161,7 @@ spec:
             {{- end }}
         {{- end }}
         {{- if and $localOrDagProcessorDisabled .Values.dags.gitSync.enabled }}
-          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }}
+          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.scheduler.extraInitContainers }}
           {{- toYaml .Values.scheduler.extraInitContainers | nindent 8 }}
diff --git a/chart/templates/triggerer/triggerer-deployment.yaml b/chart/templates/triggerer/triggerer-deployment.yaml
index ff399b93e3c28..3d327e944ac44 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -149,7 +149,7 @@ spec:
             {{- end }}
         {{- end }}
         {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }}
-          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }}
+          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.triggerer.extraInitContainers }}
           {{- toYaml .Values.triggerer.extraInitContainers | nindent 8 }}
diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml
index 06532844cd7e6..422d467093565 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -155,7 +155,7 @@ spec:
             {{- end }}
         {{- end }}
         {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) (semverCompare "<2.0.0" .Values.airflowVersion) }}
-          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }}
+          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.webserver.extraInitContainers }}
           {{- toYaml .Values.webserver.extraInitContainers | nindent 8 }}
diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index f30d0571a968b..bacba8ff0306f 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -172,7 +172,7 @@ spec:
             {{- end }}
         {{- end }}
         {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }}
-          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }}
+          {{- include "git_sync_container" (dict "Values" .Values "is_init" "true" "Template" .Template) | nindent 8 }}
         {{- end }}
         {{- if .Values.workers.extraInitContainers }}
           {{- toYaml .Values.workers.extraInitContainers | nindent 8 }}

From 86c719ddb3d59e2f5b56d57367f855e1a7feecfd Mon Sep 17 00:00:00 2001
From: Nir Rosenthal <nirr@perion.com>
Date: Sun, 18 Jun 2023 23:49:27 +0300
Subject: [PATCH 6/6] fix indent

---
 chart/values.yaml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/chart/values.yaml b/chart/values.yaml
index 1b1f0e1d69e23..c6ea8e637967d 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -2201,11 +2201,11 @@ dags:
     securityContexts:
       container: {}
 
-   # Mount additional volumes into git-sync. It can be templated like in the following example:
-   #   extraVolumeMounts:
-   #     - name: my-templated-extra-volume
-   #       mountPath: "{{ .Values.my_custom_path }}"
-   #       readOnly: true
+    # Mount additional volumes into git-sync. It can be templated like in the following example:
+    #   extraVolumeMounts:
+    #     - name: my-templated-extra-volume
+    #       mountPath: "{{ .Values.my_custom_path }}"
+    #       readOnly: true
     extraVolumeMounts: []
     env: []
     # Supported env vars for gitsync can be found at https://github.com/kubernetes/git-sync
