This is an automated email from the ASF dual-hosted git repository.
eladkal 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 764a0e3c95 fix(helm): set worker safeToEvict properly (#35130)
764a0e3c95 is described below
commit 764a0e3c956c839fee1d62f1056c8308f5c3e53d
Author: Seiji 誠 次 <[email protected]>
AuthorDate: Fri Oct 27 14:26:52 2023 -0300
fix(helm): set worker safeToEvict properly (#35130)
* fix(helm): set worker safeToEvict properly
---
chart/templates/workers/worker-deployment.yaml | 4 +---
helm_tests/airflow_core/test_worker.py | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/chart/templates/workers/worker-deployment.yaml
b/chart/templates/workers/worker-deployment.yaml
index 21f7c8fd2d..5d1adbb465 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -92,9 +92,7 @@ spec:
checksum/airflow-config: {{ include (print $.Template.BasePath
"/configmaps/configmap.yaml") . | sha256sum }}
checksum/extra-configmaps: {{ include (print $.Template.BasePath
"/configmaps/extra-configmaps.yaml") . | sha256sum }}
checksum/extra-secrets: {{ include (print $.Template.BasePath
"/secrets/extra-secrets.yaml") . | sha256sum }}
- {{- if .Values.workers.safeToEvict }}
- cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
- {{- end }}
+ cluster-autoscaler.kubernetes.io/safe-to-evict: {{
.Values.workers.safeToEvict | quote }}
{{- if .Values.airflowPodAnnotations }}
{{- toYaml .Values.airflowPodAnnotations | nindent 8 }}
{{- end }}
diff --git a/helm_tests/airflow_core/test_worker.py
b/helm_tests/airflow_core/test_worker.py
index 465f92500c..a04a42e2ad 100644
--- a/helm_tests/airflow_core/test_worker.py
+++ b/helm_tests/airflow_core/test_worker.py
@@ -651,6 +651,22 @@ class TestWorker:
assert "annotations" in jmespath.search("metadata", docs[0])
assert jmespath.search("metadata.annotations",
docs[0])["test_annotation"] == "test_annotation_value"
+ @pytest.mark.parametrize(
+ "evictionStr, evictionBool",
+ [("true", True), ("false", False)],
+ )
+ def test_safetoevict_annotations(self, evictionStr, evictionBool):
+ docs = render_chart(
+ values={"workers": {"safeToEvict": evictionBool}},
+ show_only=["templates/workers/worker-deployment.yaml"],
+ )
+ assert (
+ jmespath.search("spec.template.metadata.annotations", docs[0])[
+ "cluster-autoscaler.kubernetes.io/safe-to-evict"
+ ]
+ == evictionStr
+ )
+
class TestWorkerLogGroomer(LogGroomerTestBase):
"""Worker groomer."""