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 2020/11/15 09:37:44 UTC
[airflow] 01/19: fix helm scheduler deployment / scheduler logs
(#11685)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit f75166e32ef3269c252bb36a7c1a8ac0689f09ce
Author: Florent Chehab <fc...@meilleursagents.com>
AuthorDate: Sat Oct 31 18:55:50 2020 +0100
fix helm scheduler deployment / scheduler logs (#11685)
Based on the airflow image entrypoint, we should use airflow commands directly.
The container exits otherwise.
(cherry picked from commit 069b1f71cf9fbeaea3af2dfdc14681996dd09f4b)
---
.../templates/scheduler/scheduler-deployment.yaml | 2 +-
chart/tests/test_basic_helm_chart.py | 31 ++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index 1ed1c3a..771dd1a 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -169,7 +169,7 @@ spec:
- name: scheduler-logs
image: {{ template "airflow_image" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
- args: ["airflow", "serve_logs"]
+ args: ["serve_logs"]
ports:
- name: worker-logs
containerPort: {{ .Values.ports.workerLogs }}
diff --git a/chart/tests/test_basic_helm_chart.py b/chart/tests/test_basic_helm_chart.py
index 767a073..a9cfa16 100644
--- a/chart/tests/test_basic_helm_chart.py
+++ b/chart/tests/test_basic_helm_chart.py
@@ -16,6 +16,7 @@
# under the License.
import unittest
+from typing import Any, Dict, List, Union
import jmespath
@@ -84,3 +85,33 @@ class TestBaseChartTest(unittest.TestCase):
]
self.assertNotIn(('Job', 'TEST-BASIC-create-user'), list_of_kind_names_tuples)
self.assertEqual(OBJECT_COUNT_IN_BASIC_DEPLOYMENT - 1, len(k8s_objects))
+
+ def test_chart_is_consistent_with_official_airflow_image(self):
+ def get_k8s_objs_with_image(obj: Union[List[Any], Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """
+ Recursive helper to retrieve all the k8s objects that have an "image" key
+ inside k8s obj or list of k8s obj
+ """
+ out: List[Dict[str, Any]] = []
+ if isinstance(obj, list):
+ for item in obj:
+ out += get_k8s_objs_with_image(item)
+ if isinstance(obj, dict):
+ if "image" in obj:
+ out += [obj]
+ # include sub objs, just in case
+ for val in obj.values():
+ out += get_k8s_objs_with_image(val)
+ return out
+
+ image_repo = "test-airflow-repo/airflow"
+ k8s_objects = render_chart("TEST-BASIC", {"defaultAirflowRepository": image_repo})
+
+ objs_with_image = get_k8s_objs_with_image(k8s_objects)
+ for obj in objs_with_image:
+ image: str = obj["image"] # pylint: disable=invalid-sequence-index
+ if image.startswith(image_repo):
+ # Make sure that a command is not specified
+ self.assertNotIn("command", obj)
+ # Make sure that the first arg is never airflow
+ self.assertNotEqual(obj["args"][0], "airflow") # pylint: disable=invalid-sequence-index