From b8f652cf6bd2e8b241a02cb2e455086979abbe15 Mon Sep 17 00:00:00 2001 From: Yury Kylulin Date: Tue, 2 Nov 2021 17:47:12 +0300 Subject: Create combined image and add helm chart Changes in this commit: 1) Create self contained image, rapid scripts can be executed from the management pod and create other testing pods in the cluster. 2) Helm chart to automate rapid deployment and proper service account configuration to be able to start management pod. 3) Fix for migration to paramiko. Signed-off-by: Yury Kylulin Change-Id: I0281871cce392b3003e0274602a5c90c29af9b23 --- .../helper-scripts/rapid/rapid_k8s_deployment.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py') diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py index 2d88cd96..bfb81611 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py @@ -40,6 +40,7 @@ class K8sDeployment: _create_config = None _runtime_config = None _total_number_of_pods = 0 + _namespace = "rapid-testing" _pods = [] def __init__(self): @@ -64,7 +65,11 @@ class K8sDeployment: self._log.addHandler(console_handler) # Initialize k8s plugin - config.load_kube_config() + try: + config.load_kube_config() + except: + config.load_incluster_config() + Pod.k8s_CoreV1Api = client.CoreV1Api() def load_create_config(self, config_file_name): @@ -89,6 +94,15 @@ class K8sDeployment: self._log.debug("Total number of pods %d" % self._total_number_of_pods) + if self._create_config.has_option("DEFAULT", "namespace"): + self._namespace = self._create_config.get( + "DEFAULT", "namespace") + else: + self._log.error("No option namespace in DEFAULT section") + return -1 + + self._log.debug("Using namespace %s" % self._total_number_of_pods) + # Parse [PODx] sections for i in range(1, int(self._total_number_of_pods) + 1): # Search for POD name @@ -123,7 +137,7 @@ class K8sDeployment: else: pod_dp_subnet = "24" - pod = Pod(pod_name) + pod = Pod(pod_name, self._namespace) pod.set_nodeselector(pod_nodeselector_hostname) pod.set_dp_ip(pod_dp_ip) pod.set_dp_subnet(pod_dp_subnet) -- cgit 1.2.3-korg