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 2020/08/22 18:27:59 UTC
[airflow] branch v1-10-stable updated (b12333d -> 6416d89)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a change to branch v1-10-stable
in repository https://gitbox.apache.org/repos/asf/airflow.git.
from b12333d Update Changelog for 1.10.12rc3
new d2f55a4 Fix broken Kubernetes PodRuntimeInfoEnv (#10478)
new 6416d89 Update Changelog for 1.10.12rc4
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CHANGELOG.txt | 3 +-
airflow/kubernetes/pod_runtime_info_env.py | 2 +-
kubernetes_tests/test_kubernetes_pod_operator.py | 38 +++++++++++++++++++++++-
3 files changed, 40 insertions(+), 3 deletions(-)
[airflow] 02/02: Update Changelog for 1.10.12rc4
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v1-10-stable
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 6416d898060706787861ff8ecbc4363152a35f45
Author: Kaxil Naik <ka...@apache.org>
AuthorDate: Sat Aug 22 19:25:10 2020 +0100
Update Changelog for 1.10.12rc4
---
CHANGELOG.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 6ccb089..3164ec2 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,4 +1,4 @@
-Airflow 1.10.12, 2020-08-23
+Airflow 1.10.12, 2020-08-25
----------------------------
New Features
@@ -35,6 +35,7 @@ Bug Fixes
- Fix issue with mounting volumes from secrets (#10366)
- BugFix: K8s Executor Multinamespace mode is evaluated to true by default (#10410)
- Make KubernetesExecutor recognize kubernetes_labels (#10412)
+- Fix broken Kubernetes PodRuntimeInfoEnv (#10478)
Improvements
""""""""""""
[airflow] 01/02: Fix broken Kubernetes PodRuntimeInfoEnv (#10478)
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v1-10-stable
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit d2f55a440b5a8f9ce2867f8338830efe8cc04a54
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Sat Aug 22 17:52:41 2020 +0100
Fix broken Kubernetes PodRuntimeInfoEnv (#10478)
closes https://github.com/apache/airflow/issues/10456
(cherry picked from commit 47c6657ce012f6db147fdcce3ca5e77f46a9e491)
---
airflow/kubernetes/pod_runtime_info_env.py | 2 +-
kubernetes_tests/test_kubernetes_pod_operator.py | 38 +++++++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/airflow/kubernetes/pod_runtime_info_env.py b/airflow/kubernetes/pod_runtime_info_env.py
index 72e2151..95fbe6b 100644
--- a/airflow/kubernetes/pod_runtime_info_env.py
+++ b/airflow/kubernetes/pod_runtime_info_env.py
@@ -47,7 +47,7 @@ class PodRuntimeInfoEnv(K8SModel):
name=self.name,
value_from=k8s.V1EnvVarSource(
field_ref=k8s.V1ObjectFieldSelector(
- self.field_path
+ field_path=self.field_path
)
)
)
diff --git a/kubernetes_tests/test_kubernetes_pod_operator.py b/kubernetes_tests/test_kubernetes_pod_operator.py
index 89572f9..a5c9731 100644
--- a/kubernetes_tests/test_kubernetes_pod_operator.py
+++ b/kubernetes_tests/test_kubernetes_pod_operator.py
@@ -32,6 +32,7 @@ from airflow.kubernetes import kube_client
from airflow.kubernetes.pod import Port
from airflow.kubernetes.pod_generator import PodDefaults
from airflow.kubernetes.pod_launcher import PodLauncher
+from airflow.kubernetes.pod_runtime_info_env import PodRuntimeInfoEnv
from airflow.kubernetes.secret import Secret
from airflow.kubernetes.volume import Volume
from airflow.kubernetes.volume_mount import VolumeMount
@@ -669,7 +670,7 @@ class TestKubernetesPodOperatorSystem(unittest.TestCase):
def test_pod_failure(self):
"""
- Tests that the task fails when a pod reports a failure
+ Tests that the task fails when a pod reports a failure
"""
bad_internal_command = ["foobar 10 "]
k = KubernetesPodOperator(
@@ -780,6 +781,41 @@ class TestKubernetesPodOperatorSystem(unittest.TestCase):
))]
)
+ def test_env_vars(self):
+ # WHEN
+ k = KubernetesPodOperator(
+ namespace='default',
+ image="ubuntu:16.04",
+ cmds=["bash", "-cx"],
+ arguments=["echo 10"],
+ env_vars={"ENV1": "val1", "ENV2": "val2", },
+ pod_runtime_info_envs=[PodRuntimeInfoEnv("ENV3", "status.podIP")],
+ labels={"foo": "bar"},
+ name="test",
+ task_id="task",
+ in_cluster=False,
+ do_xcom_push=False,
+ )
+
+ context = create_context(k)
+ k.execute(context)
+
+ # THEN
+ actual_pod = self.api_client.sanitize_for_serialization(k.pod)
+ self.expected_pod['spec']['containers'][0]['env'] = [
+ {'name': 'ENV1', 'value': 'val1'},
+ {'name': 'ENV2', 'value': 'val2'},
+ {
+ 'name': 'ENV3',
+ 'valueFrom': {
+ 'fieldRef': {
+ 'fieldPath': 'status.podIP'
+ }
+ }
+ }
+ ]
+ self.assertEqual(self.expected_pod, actual_pod)
+
def test_init_container(self):
# GIVEN
volume_mounts = [k8s.V1VolumeMount(