You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2023/03/10 12:07:18 UTC
[airflow] branch main updated: Remove replicas if KEDA is enabled (#29838)
This is an automated email from the ASF dual-hosted git repository.
potiuk 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 e60be9e3d4 Remove replicas if KEDA is enabled (#29838)
e60be9e3d4 is described below
commit e60be9e3d41a64856529e594ba6c1db680650377
Author: Musaed Albrikan <32...@users.noreply.github.com>
AuthorDate: Fri Mar 10 15:07:06 2023 +0300
Remove replicas if KEDA is enabled (#29838)
---
chart/templates/workers/worker-deployment.yaml | 7 +++++--
tests/charts/test_worker.py | 13 +++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index 118e3e2fad..11f7db87d5 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -19,6 +19,7 @@
## Airflow Worker Deployment
#################################
{{- $persistence := .Values.workers.persistence.enabled }}
+{{- $keda := .Values.workers.keda.enabled }}
{{- if or (eq .Values.executor "CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor") }}
{{- $nodeSelector := or .Values.workers.nodeSelector .Values.nodeSelector }}
{{- $affinity := or .Values.workers.affinity .Values.affinity }}
@@ -44,10 +45,12 @@ metadata:
{{- toYaml .Values.workers.annotations | nindent 4 }}
{{- end }}
spec:
-{{- if $persistence }}
+ {{- if $persistence }}
serviceName: {{ .Release.Name }}-worker
-{{- end }}
+ {{- end }}
+ {{- if not $keda }}
replicas: {{ .Values.workers.replicas }}
+ {{- end }}
{{- if $revisionHistoryLimit }}
revisionHistoryLimit: {{ $revisionHistoryLimit }}
{{- end }}
diff --git a/tests/charts/test_worker.py b/tests/charts/test_worker.py
index ef30559b70..33870fa459 100644
--- a/tests/charts/test_worker.py
+++ b/tests/charts/test_worker.py
@@ -608,6 +608,19 @@ class TestWorkerKedaAutoScaler:
assert "test_label" in jmespath.search("metadata.labels", docs[0])
assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
+ def test_should_remove_replicas_field(self):
+ docs = render_chart(
+ values={
+ "executor": "CeleryExecutor",
+ "workers": {
+ "keda": {"enabled": True},
+ },
+ },
+ show_only=["templates/workers/worker-deployment.yaml"],
+ )
+
+ assert "replicas" not in jmespath.search("spec", docs[0])
+
class TestWorkerNetworkPolicy:
def test_should_add_component_specific_labels(self):