mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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
This commit is contained in:
parent
a11073df9a
commit
00ccad9764
1 changed files with 1 additions and 1 deletions
|
@ -148,7 +148,7 @@ class K8sAnsibleMixin(object):
|
||||||
if auth_set('username', 'password', 'host') or auth_set('api_key', 'host'):
|
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
|
# We have enough in the parameters to authenticate, no need to load incluster or kubeconfig
|
||||||
pass
|
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'))
|
kubernetes.config.load_kube_config(auth.get('kubeconfig'), auth.get('context'))
|
||||||
else:
|
else:
|
||||||
# First try to do incluster config, then kubeconfig
|
# First try to do incluster config, then kubeconfig
|
||||||
|
|
Loading…
Reference in a new issue