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 2018/05/11 14:39:09 UTC

incubator-airflow git commit: [AIRFLOW-2454][Airflow 2454] Support imagePullPolicy for k8s

Repository: incubator-airflow
Updated Branches:
  refs/heads/master efacc1a75 -> 80027609f


[AIRFLOW-2454][Airflow 2454] Support imagePullPolicy for k8s

Closes #3348 from jkao/k8s-operator-image-pull-
policy


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/80027609
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/80027609
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/80027609

Branch: refs/heads/master
Commit: 80027609f4ccbcf9b100f48b3d8f47947006f47d
Parents: efacc1a
Author: Jeffrey Kao <je...@soundcloud.com>
Authored: Fri May 11 15:38:59 2018 +0100
Committer: Kaxil Naik <ka...@gmail.com>
Committed: Fri May 11 15:38:59 2018 +0100

----------------------------------------------------------------------
 airflow/contrib/kubernetes/pod.py                    | 3 ++-
 airflow/contrib/operators/kubernetes_pod_operator.py | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/80027609/airflow/contrib/kubernetes/pod.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/kubernetes/pod.py b/airflow/contrib/kubernetes/pod.py
index e5e9a4d..e740bae 100644
--- a/airflow/contrib/kubernetes/pod.py
+++ b/airflow/contrib/kubernetes/pod.py
@@ -1,4 +1,3 @@
-
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -53,6 +52,8 @@ class Pod:
     :param result: The result that will be returned to the operator after
                    successful execution of the pod
     :type result: any
+    :param image_pull_policy: Specify a policy to cache or always pull an image
+    :type image_pull_policy: str
     """
     def __init__(
             self,

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/80027609/airflow/contrib/operators/kubernetes_pod_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/kubernetes_pod_operator.py b/airflow/contrib/operators/kubernetes_pod_operator.py
index a266d87..d68496a 100644
--- a/airflow/contrib/operators/kubernetes_pod_operator.py
+++ b/airflow/contrib/operators/kubernetes_pod_operator.py
@@ -76,6 +76,7 @@ class KubernetesPodOperator(BaseOperator):
 
             pod.secrets = self.secrets
             pod.envs = self.env_vars
+            pod.image_pull_policy = self.image_pull_policy
 
             launcher = pod_launcher.PodLauncher(client)
             final_state = launcher.run_pod(
@@ -102,6 +103,7 @@ class KubernetesPodOperator(BaseOperator):
                  labels=None,
                  startup_timeout_seconds=120,
                  get_logs=True,
+                 image_pull_policy='IfNotPresent',
                  *args,
                  **kwargs):
         super(KubernetesPodOperator, self).__init__(*args, **kwargs)
@@ -116,3 +118,4 @@ class KubernetesPodOperator(BaseOperator):
         self.secrets = secrets or []
         self.in_cluster = in_cluster
         self.get_logs = get_logs
+        self.image_pull_policy = image_pull_policy