Adapt kube config retrieval for certificate check 73/116573/1
authormrichomme <morgan.richomme@orange.com>
Mon, 4 Jan 2021 16:55:10 +0000 (17:55 +0100)
committermrichomme <morgan.richomme@orange.com>
Mon, 4 Jan 2021 16:55:10 +0000 (17:55 +0100)
In case of test from inside the cluster, the k8s credentials must be retrieved
using the k8s python client method load_incluster_config

Issue-ID: INT-1818*

Signed-off-by: mrichomme <morgan.richomme@orange.com>
Change-Id: If3eb2de2099f88443ae4e36a404423b2e57769b8

test/security/check_certificates/check_certificates/check_certificates_validity.py

index 87a2fa9..948783d 100644 (file)
@@ -123,7 +123,10 @@ if args.mode == "nodeport":
 
 # Kubernetes section
 # retrieve the candidate ports first
-k8s_config = config.load_kube_config()
+if args.mode == "internal":
+    k8s_config = config.load_incluster_config()
+else:
+    k8s_config = config.load_kube_config()
 
 core = client.CoreV1Api()
 api_instance = client.ExtensionsV1beta1Api(