* 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
(cherry picked from commit 00ccad9764
)
* Add changelog for k8s auth config fix
This commit is contained in:
parent
136da25bbf
commit
1c9551f93d
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/k8s_auth_kubeconfig.yml
Normal file
2
changelogs/fragments/k8s_auth_kubeconfig.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- k8s - allow kubeconfig or context to be set without the other
|
|
@ -152,7 +152,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…
Reference in a new issue