You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/21 20:19:36 UTC
[airflow] 11/44: Kubernetes worker pod doesn't use docker container
entrypoint (#12766)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 4c459106144dfae6b2d66473d0ddf5050d0b2985
Author: Daniel Imberman <da...@gmail.com>
AuthorDate: Mon Dec 7 13:54:45 2020 -0800
Kubernetes worker pod doesn't use docker container entrypoint (#12766)
* Kubernetes worker pod doesn't use docker container entrypoint
Fixes issue on openshift caused by KubernetesExecutor pods not running
via the entrypoint script
* fix
* Update UPGRADING_TO_2.0.md
Co-authored-by: Ash Berlin-Taylor <as...@firemirror.com>
* fix UPDGRADING
* @ashb comments
Co-authored-by: Ash Berlin-Taylor <as...@firemirror.com>
(cherry picked from commit 190066cf201e5b0442bbbd6df74efecae523ee76)
---
airflow/executors/kubernetes_executor.py | 2 +-
chart/templates/scheduler/scheduler-deployment.yaml | 2 +-
chart/templates/webserver/webserver-deployment.yaml | 2 +-
chart/tests/test_basic_helm_chart.py | 2 --
scripts/in_container/prod/entrypoint_prod.sh | 7 +++----
5 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/airflow/executors/kubernetes_executor.py b/airflow/executors/kubernetes_executor.py
index 73dd91e..663a9da 100644
--- a/airflow/executors/kubernetes_executor.py
+++ b/airflow/executors/kubernetes_executor.py
@@ -442,7 +442,7 @@ class AirflowKubernetesScheduler(LoggingMixin):
try_number=try_number,
kube_image=self.kube_config.kube_image,
date=execution_date,
- command=command,
+ args=command,
pod_override_object=kube_executor_config,
base_worker_pod=self.worker_configuration_pod
)
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index 61dcade..aecc008 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -107,7 +107,7 @@ spec:
- name: scheduler
image: {{ template "airflow_image" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
- args: ["scheduler"]
+ args: ["airflow", "scheduler"]
envFrom:
{{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
env:
diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml
index 25b6b63..ffa911c 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -94,7 +94,7 @@ spec:
- name: webserver
image: {{ template "airflow_image" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
- args: ["webserver"]
+ args: ["airflow", "webserver"]
resources:
{{ toYaml .Values.webserver.resources | indent 12 }}
volumeMounts:
diff --git a/chart/tests/test_basic_helm_chart.py b/chart/tests/test_basic_helm_chart.py
index a9cfa16..26ea1c1 100644
--- a/chart/tests/test_basic_helm_chart.py
+++ b/chart/tests/test_basic_helm_chart.py
@@ -113,5 +113,3 @@ class TestBaseChartTest(unittest.TestCase):
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
diff --git a/scripts/in_container/prod/entrypoint_prod.sh b/scripts/in_container/prod/entrypoint_prod.sh
index 0276e69..136074a 100755
--- a/scripts/in_container/prod/entrypoint_prod.sh
+++ b/scripts/in_container/prod/entrypoint_prod.sh
@@ -111,6 +111,7 @@ else
verify_db_connection "${AIRFLOW__CORE__SQL_ALCHEMY_CONN}"
fi
+
# The Bash and python commands still should verify the basic connections so they are run after the
# DB check but before the broker check
if [[ ${AIRFLOW_COMMAND} == "bash" ]]; then
@@ -125,7 +126,7 @@ elif [[ ${AIRFLOW_COMMAND} == "airflow" ]]; then
fi
# Note: the broker backend configuration concerns only a subset of Airflow components
-if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|worker|flower)$ ]]; then
+if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|celery|worker|flower)$ ]]; then
if [[ -n "${AIRFLOW__CELERY__BROKER_URL_CMD=}" ]]; then
verify_db_connection "$(eval "$AIRFLOW__CELERY__BROKER_URL_CMD")"
else
@@ -136,6 +137,4 @@ if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|worker|flower)$ ]]; then
fi
fi
-
-# Run the command
-exec airflow "${@}"
+exec "airflow" "${@}"