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

rom 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 2154e89967b Support multiple executors in chart (#43606)
2154e89967b is described below

commit 2154e89967b7dc8255e383ed34c2b71995589bb4
Author: jaejun <[email protected]>
AuthorDate: Mon Nov 25 00:11:44 2024 +0900

    Support multiple executors in chart (#43606)
    
    * modified values
    
    * helm test
    
    * eq to contains
    
    * combine existed tests
    
    * to contains
    
    * contains KubernetesExecutor
---
 chart/templates/NOTES.txt                                    |  6 +++---
 chart/templates/_helpers.yaml                                |  8 ++++----
 chart/templates/check-values.yaml                            |  2 +-
 chart/templates/configmaps/configmap.yaml                    |  2 +-
 chart/templates/flower/flower-deployment.yaml                |  2 +-
 chart/templates/flower/flower-ingress.yaml                   |  2 +-
 chart/templates/flower/flower-service.yaml                   |  2 +-
 chart/templates/flower/flower-serviceaccount.yaml            |  2 +-
 .../rbac/security-context-constraint-rolebinding.yaml        |  2 +-
 chart/templates/redis/redis-networkpolicy.yaml               |  2 +-
 chart/templates/redis/redis-service.yaml                     |  2 +-
 chart/templates/redis/redis-serviceaccount.yaml              |  2 +-
 chart/templates/redis/redis-statefulset.yaml                 |  2 +-
 chart/templates/scheduler/scheduler-networkpolicy.yaml       |  2 +-
 chart/templates/scheduler/scheduler-service.yaml             |  2 +-
 .../templates/secrets/result-backend-connection-secret.yaml  |  2 +-
 chart/templates/workers/worker-deployment.yaml               |  2 +-
 chart/templates/workers/worker-kedaautoscaler.yaml           |  2 +-
 chart/templates/workers/worker-networkpolicy.yaml            |  2 +-
 chart/templates/workers/worker-service.yaml                  |  2 +-
 chart/templates/workers/worker-serviceaccount.yaml           |  2 +-
 chart/values.schema.json                                     | 12 ++----------
 chart/values.yaml                                            |  4 +++-
 helm_tests/airflow_aux/test_basic_helm_chart.py              | 10 ++--------
 helm_tests/other/test_keda.py                                |  4 +++-
 25 files changed, 36 insertions(+), 46 deletions(-)

diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index 846159d6ac6..531e6e29aba 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -81,7 +81,7 @@ Airflow Webserver:
       http{{ if $tlsEnabled }}s{{ end }}://{{ (tpl $hostname $) }}{{ 
$.Values.ingress.web.path }}/
 {{- end }}
 {{- end }}
-{{- if and (or .Values.ingress.flower.enabled .Values.ingress.enabled) (or (eq 
.Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor")) }}
+{{- if and (or .Values.ingress.flower.enabled .Values.ingress.enabled) (or 
(contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)) }}
 Flower dashboard:
 {{- range .Values.ingress.flower.hosts | default (list 
.Values.ingress.flower.host) }}
       {{- $tlsEnabled := $.Values.ingress.flower.tls.enabled -}}
@@ -101,7 +101,7 @@ You can now access your dashboard(s) by executing the 
following command(s) and v
 Airflow Webserver:     kubectl port-forward svc/{{ include "airflow.fullname" 
. }}-webserver {{ .Values.ports.airflowUI }}:{{ .Values.ports.airflowUI }} 
--namespace {{ .Release.Namespace }}
 
 {{- if .Values.flower.enabled }}
-{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor")}}
+{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)}}
 Flower dashboard:      kubectl port-forward svc/{{ include "airflow.fullname" 
. }}-flower {{ .Values.ports.flowerUI }}:{{ .Values.ports.flowerUI }} 
--namespace {{ .Release.Namespace }}
 
 {{- end }}
@@ -131,7 +131,7 @@ You can get Fernet Key value by running the following:
 
 {{- end }}
 
-{{- if or (eq .Values.executor "KubernetesExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "KubernetesExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
 {{- if and (not .Values.logs.persistence.enabled) (eq (lower (tpl 
.Values.config.logging.remote_logging .)) "false") }}
 
 WARNING:
diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index 93802bd723b..25a70cb7802 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -98,7 +98,7 @@ If release name contains chart name it will be used as a full 
name.
         name: {{ template "webserver_secret_key_secret" . }}
         key: webserver-secret-key
   {{- end }}
-  {{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+  {{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
     {{- if or (semverCompare "<2.4.0" .Values.airflowVersion) 
(.Values.data.resultBackendSecretName) (.Values.data.resultBackendConnection) }}
     {{- if 
.Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__CELERY_RESULT_BACKEND }}
   # (Airflow 1.10.* variant)
@@ -150,7 +150,7 @@ If release name contains chart name it will be used as a 
full name.
   {{- range $i, $config := .Values.env }}
   - name: {{ $config.name }}
     value: {{ $config.value | quote }}
-    {{- if or (eq $.Values.executor "KubernetesExecutor") (eq 
$.Values.executor "LocalKubernetesExecutor") (eq $.Values.executor 
"CeleryKubernetesExecutor") }}
+    {{- if or (contains "KubernetesExecutor" $.Values.executor) (contains 
"LocalKubernetesExecutor" $.Values.executor) (contains 
"CeleryKubernetesExecutor" $.Values.executor) }}
   - name: AIRFLOW__KUBERNETES_ENVIRONMENT_VARIABLES__{{ $config.name }}
     value: {{ $config.value | quote }}
     {{- end }}
@@ -163,7 +163,7 @@ If release name contains chart name it will be used as a 
full name.
         name: {{ $config.secretName }}
         key: {{ default "value" $config.secretKey }}
   {{- end }}
-  {{- if or (eq $.Values.executor "LocalKubernetesExecutor") (eq 
$.Values.executor "KubernetesExecutor") (eq $.Values.executor 
"CeleryKubernetesExecutor") }}
+  {{- if or (contains "LocalKubernetesExecutor" $.Values.executor) (contains 
"KubernetesExecutor" $.Values.executor) (contains "CeleryKubernetesExecutor" 
$.Values.executor) }}
     {{- range $i, $config := .Values.secret }}
   - name: AIRFLOW__KUBERNETES_SECRETS__{{ $config.envName }}
     value: {{ printf "%s=%s" $config.secretName $config.secretKey }}
@@ -1056,7 +1056,7 @@ capabilities:
         key: {{ $config.valueFrom.configMapKeyRef.key }}
       {{- end }}
     {{- end }}
-    {{- if or (eq $.Values.executor "KubernetesExecutor") (eq 
$.Values.executor "LocalKubernetesExecutor") (eq $.Values.executor 
"CeleryKubernetesExecutor") }}
+    {{- if or (contains "KubernetesExecutor" $.Values.executor) (contains 
"LocalKubernetesExecutor" $.Values.executor) (contains 
"CeleryKubernetesExecutor" $.Values.executor) }}
   - name: AIRFLOW__KUBERNETES_ENVIRONMENT_VARIABLES__{{ $config.name }}
     {{- if $config.value }}
     value: {{ $config.value | quote }}
diff --git a/chart/templates/check-values.yaml 
b/chart/templates/check-values.yaml
index b1c27240500..6dfbbd95541 100644
--- a/chart/templates/check-values.yaml
+++ b/chart/templates/check-values.yaml
@@ -27,7 +27,7 @@ The sole purpose of this yaml file is it to check the values 
file is consistent
 #############################
 */ -}}
 
-  {{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+  {{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
     {{- if .Values.redis.enabled }}
 
       {{- if .Values.redis.passwordSecretName }}
diff --git a/chart/templates/configmaps/configmap.yaml 
b/chart/templates/configmaps/configmap.yaml
index b93c1cbe1e5..cb8139cc6ee 100644
--- a/chart/templates/configmaps/configmap.yaml
+++ b/chart/templates/configmaps/configmap.yaml
@@ -57,7 +57,7 @@ data:
     {{- .Values.dags.gitSync.knownHosts | nindent 4 }}
   {{- end }}
 
-{{- if or (eq $.Values.executor "LocalKubernetesExecutor") (eq 
$.Values.executor "KubernetesExecutor") (eq $.Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "LocalKubernetesExecutor" $.Values.executor) (contains 
"KubernetesExecutor" $.Values.executor) (contains "CeleryKubernetesExecutor" 
$.Values.executor) }}
 {{- if semverCompare ">=1.10.12" .Values.airflowVersion }}
   pod_template_file.yaml: |-
     {{- if .Values.podTemplate }}
diff --git a/chart/templates/flower/flower-deployment.yaml 
b/chart/templates/flower/flower-deployment.yaml
index 62f961160ed..1f2b1b1fa1f 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -21,7 +21,7 @@
 ## Airflow Flower Deployment
 #################################
 {{- if .Values.flower.enabled }}
-{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
 {{- $nodeSelector := or .Values.flower.nodeSelector .Values.nodeSelector }}
 {{- $affinity := or .Values.flower.affinity .Values.affinity }}
 {{- $tolerations := or .Values.flower.tolerations .Values.tolerations }}
diff --git a/chart/templates/flower/flower-ingress.yaml 
b/chart/templates/flower/flower-ingress.yaml
index 1b24d825880..fde9db6ecb4 100644
--- a/chart/templates/flower/flower-ingress.yaml
+++ b/chart/templates/flower/flower-ingress.yaml
@@ -21,7 +21,7 @@
 ## Airflow Flower Ingress
 #################################
 {{- if .Values.flower.enabled }}
-{{- if and (or .Values.ingress.flower.enabled .Values.ingress.enabled) (or (eq 
.Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor")) }}
+{{- if and (or .Values.ingress.flower.enabled .Values.ingress.enabled) (or 
(contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)) }}
 {{- $fullname := (include "airflow.fullname" .) }}
 apiVersion: networking.k8s.io/v1
 kind: Ingress
diff --git a/chart/templates/flower/flower-service.yaml 
b/chart/templates/flower/flower-service.yaml
index 0847ff62742..1a023d5575a 100644
--- a/chart/templates/flower/flower-service.yaml
+++ b/chart/templates/flower/flower-service.yaml
@@ -21,7 +21,7 @@
 ## Airflow Flower Service Component
 #################################
 {{- if .Values.flower.enabled }}
-{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/chart/templates/flower/flower-serviceaccount.yaml 
b/chart/templates/flower/flower-serviceaccount.yaml
index efe621c6252..7eae8d52bed 100644
--- a/chart/templates/flower/flower-serviceaccount.yaml
+++ b/chart/templates/flower/flower-serviceaccount.yaml
@@ -20,7 +20,7 @@
 ######################################
 ## Airflow Flower ServiceAccount
 ######################################
-{{- if and .Values.flower.enabled (or (eq .Values.executor "CeleryExecutor") 
(eq .Values.executor "CeleryKubernetesExecutor")) 
.Values.flower.serviceAccount.create }}
+{{- if and .Values.flower.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) 
.Values.flower.serviceAccount.create }}
 apiVersion: v1
 kind: ServiceAccount
 automountServiceAccountToken: {{ 
.Values.flower.serviceAccount.automountServiceAccountToken }}
diff --git a/chart/templates/rbac/security-context-constraint-rolebinding.yaml 
b/chart/templates/rbac/security-context-constraint-rolebinding.yaml
index bd95c5b779b..0ac7542c167 100644
--- a/chart/templates/rbac/security-context-constraint-rolebinding.yaml
+++ b/chart/templates/rbac/security-context-constraint-rolebinding.yaml
@@ -67,7 +67,7 @@ subjects:
     name: {{ include "statsd.serviceAccountName" . }}
     namespace: "{{ .Release.Namespace }}"
   {{- end }}
-  {{- if and .Values.flower.enabled (or (eq .Values.executor "CeleryExecutor") 
(eq .Values.executor "CeleryKubernetesExecutor")) }}
+  {{- if and .Values.flower.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
   - kind: ServiceAccount
     name: {{ include "flower.serviceAccountName" . }}
     namespace: "{{ .Release.Namespace }}"
diff --git a/chart/templates/redis/redis-networkpolicy.yaml 
b/chart/templates/redis/redis-networkpolicy.yaml
index 457d1830991..6a186a4b685 100644
--- a/chart/templates/redis/redis-networkpolicy.yaml
+++ b/chart/templates/redis/redis-networkpolicy.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Redis NetworkPolicy
 #################################
-{{- if and .Values.redis.enabled .Values.networkPolicies.enabled (or (eq 
.Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor")) }}
+{{- if and .Values.redis.enabled .Values.networkPolicies.enabled (or (contains 
"CeleryExecutor" .Values.executor) (contains "CeleryKubernetesExecutor" 
.Values.executor)) }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
 metadata:
diff --git a/chart/templates/redis/redis-service.yaml 
b/chart/templates/redis/redis-service.yaml
index ee010901ef8..40424a7313e 100644
--- a/chart/templates/redis/redis-service.yaml
+++ b/chart/templates/redis/redis-service.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Redis Service
 #################################
-{{- if and .Values.redis.enabled (or (eq .Values.executor "CeleryExecutor") 
(eq .Values.executor "CeleryKubernetesExecutor")) }}
+{{- if and .Values.redis.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/chart/templates/redis/redis-serviceaccount.yaml 
b/chart/templates/redis/redis-serviceaccount.yaml
index 42921f3f30d..06f33e12f5d 100644
--- a/chart/templates/redis/redis-serviceaccount.yaml
+++ b/chart/templates/redis/redis-serviceaccount.yaml
@@ -20,7 +20,7 @@
 ######################################
 ## Airflow Redis ServiceAccount
 ######################################
-{{- if and .Values.redis.enabled .Values.redis.serviceAccount.create (or (eq 
.Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor")) }}
+{{- if and .Values.redis.enabled .Values.redis.serviceAccount.create (or 
(contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor)) }}
 apiVersion: v1
 kind: ServiceAccount
 automountServiceAccountToken: {{ 
.Values.redis.serviceAccount.automountServiceAccountToken }}
diff --git a/chart/templates/redis/redis-statefulset.yaml 
b/chart/templates/redis/redis-statefulset.yaml
index 95df10ccf23..d1e1edef808 100644
--- a/chart/templates/redis/redis-statefulset.yaml
+++ b/chart/templates/redis/redis-statefulset.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Redis StatefulSet
 #################################
-{{- if and .Values.redis.enabled (or (eq .Values.executor "CeleryExecutor") 
(eq .Values.executor "CeleryKubernetesExecutor")) }}
+{{- if and .Values.redis.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
 {{- $nodeSelector := or .Values.redis.nodeSelector .Values.nodeSelector }}
 {{- $affinity := or .Values.redis.affinity .Values.affinity }}
 {{- $tolerations := or .Values.redis.tolerations .Values.tolerations }}
diff --git a/chart/templates/scheduler/scheduler-networkpolicy.yaml 
b/chart/templates/scheduler/scheduler-networkpolicy.yaml
index f1c04ad4bca..4327e8f89b5 100644
--- a/chart/templates/scheduler/scheduler-networkpolicy.yaml
+++ b/chart/templates/scheduler/scheduler-networkpolicy.yaml
@@ -43,7 +43,7 @@ spec:
       release: {{ .Release.Name }}
   policyTypes:
   - Ingress
-  {{- if eq .Values.executor "LocalExecutor" }}
+  {{- if contains "LocalExecutor" .Values.executor }}
   ingress:
   - from:
     - podSelector:
diff --git a/chart/templates/scheduler/scheduler-service.yaml 
b/chart/templates/scheduler/scheduler-service.yaml
index aa28563deb8..1ac300648cd 100644
--- a/chart/templates/scheduler/scheduler-service.yaml
+++ b/chart/templates/scheduler/scheduler-service.yaml
@@ -21,7 +21,7 @@
 ## Airflow Scheduler Service
 #################################
 {{- if .Values.scheduler.enabled }}
-{{- if or (eq .Values.executor "LocalExecutor") (eq .Values.executor 
"LocalKubernetesExecutor") }}
+{{- if or (contains "LocalExecutor" .Values.executor) (contains 
"LocalKubernetesExecutor" .Values.executor) }}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/chart/templates/secrets/result-backend-connection-secret.yaml 
b/chart/templates/secrets/result-backend-connection-secret.yaml
index e89046d3dde..5a1b3171e6e 100644
--- a/chart/templates/secrets/result-backend-connection-secret.yaml
+++ b/chart/templates/secrets/result-backend-connection-secret.yaml
@@ -21,7 +21,7 @@
 ## Airflow Result Backend Secret
 #################################
 {{- if not .Values.data.resultBackendSecretName }}
-{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
 {{- if or (semverCompare "<2.4.0" .Values.airflowVersion) (and (semverCompare 
">=2.4.0" .Values.airflowVersion) .Values.data.resultBackendConnection) }}
 {{- $connection := .Values.data.resultBackendConnection | default 
.Values.data.metadataConnection }}
 {{- $resultBackendHost := $connection.host | default (printf "%s-%s" 
.Release.Name "postgresql") }}
diff --git a/chart/templates/workers/worker-deployment.yaml 
b/chart/templates/workers/worker-deployment.yaml
index 5499e64ebec..a029b1c1425 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -23,7 +23,7 @@
 {{- $persistence := .Values.workers.persistence.enabled }}
 {{- $keda := .Values.workers.keda.enabled }}
 {{- $hpa := and .Values.workers.hpa.enabled (not .Values.workers.keda.enabled) 
}}
-{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
 {{- $nodeSelector := or .Values.workers.nodeSelector .Values.nodeSelector }}
 {{- $affinity := or .Values.workers.affinity .Values.affinity }}
 {{- $tolerations := or .Values.workers.tolerations .Values.tolerations }}
diff --git a/chart/templates/workers/worker-kedaautoscaler.yaml 
b/chart/templates/workers/worker-kedaautoscaler.yaml
index 74af09b1745..0f1ca7a1cba 100644
--- a/chart/templates/workers/worker-kedaautoscaler.yaml
+++ b/chart/templates/workers/worker-kedaautoscaler.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Worker KEDA Scaler
 #################################
-{{- if and .Values.workers.keda.enabled (has .Values.executor (list 
"CeleryExecutor" "CeleryKubernetesExecutor")) }}
+{{- if and .Values.workers.keda.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor) ) }}
 apiVersion: keda.sh/v1alpha1
 kind: ScaledObject
 metadata:
diff --git a/chart/templates/workers/worker-networkpolicy.yaml 
b/chart/templates/workers/worker-networkpolicy.yaml
index 05de7931145..41bdb5d0e7f 100644
--- a/chart/templates/workers/worker-networkpolicy.yaml
+++ b/chart/templates/workers/worker-networkpolicy.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Worker NetworkPolicy
 #################################
-{{- if and .Values.networkPolicies.enabled (or (eq .Values.executor 
"CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor")) }}
+{{- if and .Values.networkPolicies.enabled (or (contains "CeleryExecutor" 
.Values.executor) (contains "CeleryKubernetesExecutor" .Values.executor)) }}
 apiVersion: networking.k8s.io/v1
 kind: NetworkPolicy
 metadata:
diff --git a/chart/templates/workers/worker-service.yaml 
b/chart/templates/workers/worker-service.yaml
index 463f51c0bb2..41f96d6ab36 100644
--- a/chart/templates/workers/worker-service.yaml
+++ b/chart/templates/workers/worker-service.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Worker Service
 #################################
-{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor 
"CeleryKubernetesExecutor") }}
+{{- if or (contains "CeleryExecutor" .Values.executor) (contains 
"CeleryKubernetesExecutor" .Values.executor) }}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/chart/templates/workers/worker-serviceaccount.yaml 
b/chart/templates/workers/worker-serviceaccount.yaml
index 87dbb972847..0feec8de3d9 100644
--- a/chart/templates/workers/worker-serviceaccount.yaml
+++ b/chart/templates/workers/worker-serviceaccount.yaml
@@ -20,7 +20,7 @@
 ################################
 ## Airflow Worker ServiceAccount
 #################################
-{{- if and .Values.workers.serviceAccount.create (or (eq .Values.executor 
"CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor") (eq 
.Values.executor "KubernetesExecutor") (eq .Values.executor 
"LocalKubernetesExecutor")) }}
+{{- if and .Values.workers.serviceAccount.create (or (contains 
"CeleryExecutor" .Values.executor) (contains "CeleryKubernetesExecutor" 
.Values.executor) (contains "KubernetesExecutor" .Values.executor) (contains 
"LocalKubernetesExecutor" .Values.executor)) }}
 apiVersion: v1
 kind: ServiceAccount
 automountServiceAccountToken: {{ 
.Values.workers.serviceAccount.automountServiceAccountToken }}
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 2408355ce7c..6bfa5fe8b5e 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -687,15 +687,7 @@
             "type": "string",
             "x-docsSection": "Common",
             "default": "CeleryExecutor",
-            "enum": [
-                "LocalExecutor",
-                "LocalKubernetesExecutor",
-                "CeleryExecutor",
-                "KubernetesExecutor",
-                "CeleryKubernetesExecutor",
-                
"airflow.providers.amazon.aws.executors.batch.AwsBatchExecutor",
-                "airflow.providers.amazon.aws.executors.ecs.AwsEcsExecutor"
-            ]
+            "pattern": 
"^(LocalExecutor|LocalKubernetesExecutor|CeleryExecutor|KubernetesExecutor|CeleryKubernetesExecutor|airflow.providers.amazon.aws.executors.batch.AwsBatchExecutor|airflow.providers.amazon.aws.executors.ecs.AwsEcsExecutor)(,(LocalExecutor|LocalKubernetesExecutor|CeleryExecutor|KubernetesExecutor|CeleryKubernetesExecutor|airflow.providers.amazon.aws.executors.batch.AwsBatchExecutor|airflow.providers.amazon.aws.executors.ecs.AwsEcsExecutor))*$"
         },
         "allowPodLaunching": {
             "description": "Whether various Airflow components launch pods.",
@@ -1717,7 +1709,7 @@
                         "query": {
                             "description": "Query to use for KEDA autoscaling. 
Must return a single integer.",
                             "type": "string",
-                            "default": "SELECT ceil(COUNT(*)::decimal / {{ 
.Values.config.celery.worker_concurrency }}) FROM task_instance WHERE 
(state='running' OR state='queued') {{- if eq .Values.executor 
\"CeleryKubernetesExecutor\" }} AND queue != '{{ 
.Values.config.celery_kubernetes_executor.kubernetes_queue }}' {{- end }}"
+                            "default": "SELECT ceil(COUNT(*)::decimal / {{ 
.Values.config.celery.worker_concurrency }}) FROM task_instance WHERE 
(state='running' OR state='queued') {{- if or (contains 
\"CeleryKubernetesExecutor\" .Values.executor) (contains \"KubernetesExecutor\" 
.Values.executor) }} AND queue != '{{ 
.Values.config.celery_kubernetes_executor.kubernetes_queue }}' {{- end }}"
                         },
                         "usePgbouncer": {
                             "description": "Weather to use PGBouncer to 
connect to the database or not when it is enabled. This configuration will be 
ignored if PGBouncer is not enabled.",
diff --git a/chart/values.yaml b/chart/values.yaml
index d0db1f7d2e9..495fa25749c 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -324,6 +324,7 @@ rbac:
 
 # Airflow executor
 # One of: LocalExecutor, LocalKubernetesExecutor, CeleryExecutor, 
KubernetesExecutor, CeleryKubernetesExecutor
+# Specify executors in a prioritized list to leverage multiple execution 
environments as needed.
 executor: "CeleryExecutor"
 
 # If this is true and using 
LocalExecutor/KubernetesExecutor/CeleryKubernetesExecutor, the scheduler's
@@ -655,7 +656,8 @@ workers:
       SELECT ceil(COUNT(*)::decimal / {{ 
.Values.config.celery.worker_concurrency }})
       FROM task_instance
       WHERE (state='running' OR state='queued')
-      {{- if eq .Values.executor "CeleryKubernetesExecutor" }}
+      {{- if or (contains "CeleryKubernetesExecutor" .Values.executor)
+      (contains "KubernetesExecutor" .Values.executor) }}
       AND queue != '{{ 
.Values.config.celery_kubernetes_executor.kubernetes_queue }}'
       {{- end }}
 
diff --git a/helm_tests/airflow_aux/test_basic_helm_chart.py 
b/helm_tests/airflow_aux/test_basic_helm_chart.py
index 54ee0725793..3bdee86df0a 100644
--- a/helm_tests/airflow_aux/test_basic_helm_chart.py
+++ b/helm_tests/airflow_aux/test_basic_helm_chart.py
@@ -538,6 +538,7 @@ class TestBaseChartTest:
             "CeleryKubernetesExecutor",
             "airflow.providers.amazon.aws.executors.batch.AwsBatchExecutor",
             "airflow.providers.amazon.aws.executors.ecs.AwsEcsExecutor",
+            "CeleryExecutor,KubernetesExecutor",
         ],
     )
     def test_supported_executor(self, executor):
@@ -549,20 +550,13 @@ class TestBaseChartTest:
         )
 
     def test_unsupported_executor(self):
-        with pytest.raises(CalledProcessError) as ex_ctx:
+        with pytest.raises(CalledProcessError):
             render_chart(
                 "test-basic",
                 {
                     "executor": "SequentialExecutor",
                 },
             )
-        assert (
-            'executor must be one of the following: "LocalExecutor", '
-            '"LocalKubernetesExecutor", "CeleryExecutor", '
-            '"KubernetesExecutor", "CeleryKubernetesExecutor", '
-            '"airflow.providers.amazon.aws.executors.batch.AwsBatchExecutor", '
-            '"airflow.providers.amazon.aws.executors.ecs.AwsEcsExecutor"' in 
ex_ctx.value.stderr.decode()
-        )
 
     @pytest.mark.parametrize(
         "image",
diff --git a/helm_tests/other/test_keda.py b/helm_tests/other/test_keda.py
index 8f4661fe35b..09fa4985f28 100644
--- a/helm_tests/other/test_keda.py
+++ b/helm_tests/other/test_keda.py
@@ -88,7 +88,7 @@ class TestKeda:
             f"SELECT ceil(COUNT(*)::decimal / {concurrency}) "
             "FROM task_instance WHERE (state='running' OR state='queued')"
         )
-        if executor == "CeleryKubernetesExecutor":
+        if "CeleryKubernetesExecutor" in executor or "KubernetesExecutor" in 
executor:
             query += f" AND queue != '{queue or 'kubernetes'}'"
         return query
 
@@ -121,6 +121,8 @@ class TestKeda:
             ("CeleryExecutor", "my_queue", False),
             ("CeleryKubernetesExecutor", None, True),
             ("CeleryKubernetesExecutor", "my_queue", True),
+            ("CeleryExecutor,KubernetesExecutor", "None", False),
+            ("CeleryExecutor,KubernetesExecutor", "my_queue", True),
         ],
     )
     def test_keda_query_kubernetes_queue(self, executor, queue, should_filter):

Reply via email to