From 00ccad97642dd125c196e0336c79bac0a5250316 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Tue, 23 Oct 2018 16:53:22 +1000 Subject: [PATCH] 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 --- lib/ansible/module_utils/k8s/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/k8s/common.py b/lib/ansible/module_utils/k8s/common.py index e371c6d51f1..caecdecdb68 100644 --- a/lib/ansible/module_utils/k8s/common.py +++ b/lib/ansible/module_utils/k8s/common.py @@ -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