summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py
diff options
context:
space:
mode:
authorYury Kylulin <yury.kylulin@intel.com>2021-11-02 17:47:12 +0300
committerYury Kylulin <yury.kylulin@intel.com>2021-11-02 18:01:48 +0300
commitb8f652cf6bd2e8b241a02cb2e455086979abbe15 (patch)
tree0f49bd0816b895e0d8d42e5d5471af4d55bcd6e7 /VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py
parent75597545ef748d7113591cdbfc8d1aaa88cf15cb (diff)
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 <yury.kylulin@intel.com> Change-Id: I0281871cce392b3003e0274602a5c90c29af9b23
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py18
1 files changed, 16 insertions, 2 deletions
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)