Skip to content

Commit

Permalink
[AIRFLOW-5501] Make default in_cluster value in KubernetesPodOperat…
Browse files Browse the repository at this point in the history
…or respect config (#6124)

(cherry-picked from e54fba5)
  • Loading branch information
kaxil committed Jan 23, 2020
1 parent 83447d3 commit 645e021
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions airflow/contrib/operators/kubernetes_pod_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(self, # pylint: disable=too-many-arguments,too-many-locals
volumes=None,
env_vars=None,
secrets=None,
in_cluster=True,
in_cluster=None,
cluster_context=None,
labels=None,
startup_timeout_seconds=120,
Expand Down Expand Up @@ -191,9 +191,13 @@ def __init__(self, # pylint: disable=too-many-arguments,too-many-locals

def execute(self, context):
try:
client = kube_client.get_kube_client(in_cluster=self.in_cluster,
cluster_context=self.cluster_context,
config_file=self.config_file)
if self.in_cluster is not None:
client = kube_client.get_kube_client(in_cluster=self.in_cluster,
cluster_context=self.cluster_context,
config_file=self.config_file)
else:
client = kube_client.get_kube_client(cluster_context=self.cluster_context,
config_file=self.config_file)

# Add Airflow Version to the label
# And a label to identify that pod is launched by KubernetesPodOperator
Expand Down

0 comments on commit 645e021

Please sign in to comment.