You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by di...@apache.org on 2020/06/04 01:33:30 UTC

[airflow] branch v1-10-test updated: [AIRFLOW-5443] Use alpine image in Kubernetes's sidecar (#6059)

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

dimberman pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v1-10-test by this push:
     new 7a9e691  [AIRFLOW-5443] Use alpine image in Kubernetes's sidecar (#6059)
7a9e691 is described below

commit 7a9e6915b1bdaa6f63871543c1537f20cd8497eb
Author: Kamil BreguĊ‚a <mi...@users.noreply.github.com>
AuthorDate: Mon Sep 9 14:42:06 2019 +0200

    [AIRFLOW-5443] Use alpine image in Kubernetes's sidecar (#6059)
    
    
    (cherry picked from commit 6b2a290ddf7a722d6a20d5c37c2e244c944d1531)
---
 airflow/kubernetes/pod_generator.py    | 12 +++---------
 tests/kubernetes/test_pod_generator.py |  4 ++--
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/airflow/kubernetes/pod_generator.py b/airflow/kubernetes/pod_generator.py
index 249a5ad..16a311f 100644
--- a/airflow/kubernetes/pod_generator.py
+++ b/airflow/kubernetes/pod_generator.py
@@ -33,13 +33,7 @@ class PodDefaults:
     """
     XCOM_MOUNT_PATH = '/airflow/xcom'
     SIDECAR_CONTAINER_NAME = 'airflow-xcom-sidecar'
-    XCOM_CMD = """import time
-while True:
-    try:
-        time.sleep(3600)
-    except KeyboardInterrupt:
-        exit(0)
-    """
+    XCOM_CMD = 'trap "exit 0" INT; while true; do sleep 30; done;'
     VOLUME_MOUNT = k8s.V1VolumeMount(
         name='xcom',
         mount_path=XCOM_MOUNT_PATH
@@ -50,8 +44,8 @@ while True:
     )
     SIDECAR_CONTAINER = k8s.V1Container(
         name=SIDECAR_CONTAINER_NAME,
-        command=['python', '-c', XCOM_CMD],
-        image='python:3.5-alpine',
+        command=['sh', '-c', XCOM_CMD],
+        image='alpine',
         volume_mounts=[VOLUME_MOUNT]
     )
 
diff --git a/tests/kubernetes/test_pod_generator.py b/tests/kubernetes/test_pod_generator.py
index 00ad2bd..bc6de96 100644
--- a/tests/kubernetes/test_pod_generator.py
+++ b/tests/kubernetes/test_pod_generator.py
@@ -178,8 +178,8 @@ class TestPodGenerator(unittest.TestCase):
         result_dict = self.k8s_client.sanitize_for_serialization(result)
         container_two = {
             'name': 'airflow-xcom-sidecar',
-            'image': 'python:3.5-alpine',
-            'command': ['python', '-c', PodDefaults.XCOM_CMD],
+            'image': "alpine",
+            'command': ['sh', '-c', PodDefaults.XCOM_CMD],
             'volumeMounts': [
                 {
                     'name': 'xcom',