Skip to content

Commit

Permalink
[AIRFLOW-5443] Use alpine image in Kubernetes's sidecar (#6059)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6b2a290)
  • Loading branch information
mik-laj authored and astro-sql-decorator committed Jun 4, 2020
1 parent aaaa366 commit 7a9e691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions airflow/kubernetes/pod_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,8 +44,8 @@ class PodDefaults:
)
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]
)

Expand Down
4 changes: 2 additions & 2 deletions tests/kubernetes/test_pod_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def test_gen_pod_extract_xcom(self, mock_uuid):
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',
Expand Down

0 comments on commit 7a9e691

Please sign in to comment.