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/08/19 22:38:40 UTC
[airflow] branch v1-10-test updated: we should take the user labels
into consideration when generating pods
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 14d92bb we should take the user labels into consideration when generating pods
14d92bb is described below
commit 14d92bb29d96b5da3fe4006f442e4560839f03cb
Author: Daniel Imberman <da...@gmail.com>
AuthorDate: Wed Aug 19 15:36:28 2020 -0700
we should take the user labels into consideration when generating pods
---
airflow/kubernetes/pod_generator.py | 5 +++--
airflow/kubernetes/worker_configuration.py | 1 +
tests/kubernetes/test_worker_configuration.py | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/airflow/kubernetes/pod_generator.py b/airflow/kubernetes/pod_generator.py
index 2c7145d..ed518d1 100644
--- a/airflow/kubernetes/pod_generator.py
+++ b/airflow/kubernetes/pod_generator.py
@@ -614,8 +614,9 @@ def merge_objects(base_obj, client_obj):
client_obj_cp = copy.deepcopy(client_obj)
if isinstance(base_obj, dict) and isinstance(client_obj_cp, dict):
- client_obj_cp.update(base_obj)
- return client_obj_cp
+ base_obj_cp = copy.deepcopy(base_obj)
+ base_obj_cp.update(client_obj_cp)
+ return base_obj_cp
for base_key in base_obj.to_dict().keys():
base_val = getattr(base_obj, base_key, None)
diff --git a/airflow/kubernetes/worker_configuration.py b/airflow/kubernetes/worker_configuration.py
index 5214d4c..fc25331 100644
--- a/airflow/kubernetes/worker_configuration.py
+++ b/airflow/kubernetes/worker_configuration.py
@@ -441,6 +441,7 @@ class WorkerConfiguration(LoggingMixin):
image_pull_secrets=self.kube_config.image_pull_secrets,
volumes=self._get_volumes(),
volume_mounts=self._get_volume_mounts(),
+ labels=self.kube_config.kube_labels,
init_containers=self._get_init_containers(),
annotations=self.kube_config.kube_annotations,
affinity=self.kube_config.kube_affinity,
diff --git a/tests/kubernetes/test_worker_configuration.py b/tests/kubernetes/test_worker_configuration.py
index 59c9326..40271dc 100644
--- a/tests/kubernetes/test_worker_configuration.py
+++ b/tests/kubernetes/test_worker_configuration.py
@@ -391,6 +391,7 @@ class TestKubernetesWorkerConfiguration(unittest.TestCase):
'dag_id': 'test_dag_id',
'execution_date': '2019-11-21 11:08:22.920875',
'kubernetes_executor': 'True',
+ 'my_label': 'label_id',
'task_id': 'test_task_id',
'try_number': '1'
}