Fix k8s driver when using in cluster config
We need to catch now the ConfigException like in the reset method to see if we had no config file. Change-Id: I648167a40d6e62efc2ab834b89ce49c8efddf974 Story: 2008533 Task: 41619
This commit is contained in:
parent
e7f831c34e
commit
90b79dea18
@ -59,7 +59,13 @@ class KubernetesProvider(Provider, QuotaSupport):
|
||||
self.log.debug("Kubernetes config file not found, attempting "
|
||||
"to load in-cluster configs")
|
||||
conf = k8s_config.load_incluster_config()
|
||||
|
||||
except k8s_config.config_exception.ConfigException as e:
|
||||
if 'Invalid kube-config file. No configuration found.' in str(e):
|
||||
self.log.debug("Kubernetes config file not found, attempting "
|
||||
"to load in-cluster configs")
|
||||
conf = k8s_config.load_incluster_config()
|
||||
else:
|
||||
raise
|
||||
return (
|
||||
k8s_client.CoreV1Api(conf),
|
||||
k8s_client.RbacAuthorizationV1beta1Api(conf))
|
||||
|
Loading…
Reference in New Issue
Block a user