Use kubeconfig if either context or kubeconfig is set (#47373)

kubeconfig should be loaded if *either* or both of context
or kubeconfig is set (this allows picking a context and default
kubeconfig or picking a kubeconfig with default context)

Fixes #47149
pull/47387/head
Will Thames 6 years ago committed by John R Barker
parent a11073df9a
commit 00ccad9764

@ -148,7 +148,7 @@ class K8sAnsibleMixin(object):
if auth_set('username', 'password', 'host') or auth_set('api_key', 'host'):
# We have enough in the parameters to authenticate, no need to load incluster or kubeconfig
pass
elif auth_set('kubeconfig', 'context'):
elif auth_set('kubeconfig') or auth_set('context'):
kubernetes.config.load_kube_config(auth.get('kubeconfig'), auth.get('context'))
else:
# First try to do incluster config, then kubeconfig

Loading…
Cancel
Save