This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 2508787ea3 Template extra volumes in helm chart (#30773)
2508787ea3 is described below

commit 2508787ea35bb5d64c8632f1e6075a753a467500
Author: Nir Rosenthal <[email protected]>
AuthorDate: Wed Jun 21 18:37:27 2023 +0300

    Template extra volumes in helm chart (#30773)
---
 chart/files/pod-template-file.kubernetes-helm-yaml |  2 +-
 chart/templates/_helpers.yaml                      |  2 +-
 .../dag-processor/dag-processor-deployment.yaml    |  6 +-
 chart/templates/flower/flower-deployment.yaml      |  4 +-
 chart/templates/jobs/create-user-job.yaml          |  4 +-
 .../templates/pgbouncer/pgbouncer-deployment.yaml  |  4 +-
 .../templates/scheduler/scheduler-deployment.yaml  |  6 +-
 .../templates/triggerer/triggerer-deployment.yaml  | 10 ++--
 .../templates/webserver/webserver-deployment.yaml  |  4 +-
 chart/templates/workers/worker-deployment.yaml     | 12 ++--
 chart/values.yaml                                  | 70 ++++++++++++++++++++--
 11 files changed, 92 insertions(+), 32 deletions(-)

diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml 
b/chart/files/pod-template-file.kubernetes-helm-yaml
index 3fa53f1e5c..1f3dbc909d 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/_helpers.yaml b/chart/templates/_helpers.yaml
index c34f99d791..0a707c4184 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -244,7 +244,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 d2498b495d..5515ac4b87 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 }}
@@ -156,7 +156,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" . }}
@@ -235,7 +235,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 96bb8dd267..199d9010d3 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -103,7 +103,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
@@ -156,7 +156,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 9ac510c2ba..94d0970ae4 100644
--- a/chart/templates/jobs/create-user-job.yaml
+++ b/chart/templates/jobs/create-user-job.yaml
@@ -109,7 +109,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 }}
@@ -122,6 +122,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 71e42cce37..fde07807c4 100644
--- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
@@ -141,7 +141,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:
@@ -191,6 +191,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 ec466660e9..1c752dc003 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -146,7 +146,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 }}
@@ -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 }}
@@ -222,7 +222,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 d61dfb79f8..3d327e944a 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -134,7 +134,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 }}
@@ -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 }}
@@ -171,7 +171,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" . }}
@@ -232,7 +232,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 }}
@@ -265,7 +265,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 0fb8447a16..422d467093 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -140,7 +140,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 }}
@@ -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 1ce904c336..bacba8ff03 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -157,7 +157,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 }}
@@ -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 }}
@@ -213,7 +213,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" . }}
@@ -278,7 +278,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 }}
@@ -310,7 +310,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 }}
@@ -332,7 +332,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:
diff --git a/chart/values.yaml b/chart/values.yaml
index 944b00574e..c6ea8e6379 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -889,7 +889,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: []
 
@@ -1273,7 +1284,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: []
 
@@ -1402,7 +1424,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: []
 
@@ -1538,7 +1571,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: []
 
@@ -1735,7 +1779,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: []
 
@@ -2146,6 +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
     extraVolumeMounts: []
     env: []
     # Supported env vars for gitsync can be found at 
https://github.com/kubernetes/git-sync

Reply via email to