[VOL-3780] using keywords in physical build
Change-Id: I6fbe3797f57920b5d8ebb2419c8c2ba6de9d0901
diff --git a/vars/getPodsInfo.groovy b/vars/getPodsInfo.groovy
new file mode 100644
index 0000000..28fc81d
--- /dev/null
+++ b/vars/getPodsInfo.groovy
@@ -0,0 +1,13 @@
+// This keyword will get all the kubernetes pods info needed for debugging
+// the only parameter required is the destination folder to store the collected information
+def call(String dest) {
+ sh """
+ mkdir -p ${dest}
+ kubectl get pods --all-namespaces -o wide | tee ${dest}/pods.txt || true
+ kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee ${dest}/pod-images.txt || true
+ kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee ${dest}/pod-imagesId.txt || true
+ kubectl describe pods --all-namespaces -l app.kubernetes.io/part-of=voltha > ${dest}/voltha-pods-describe.txt
+ kubectl describe pods --all-namespaces -l app=onos-classic > ${dest}/onos-pods-describe.txt
+ helm ls --all-namespaces | tee ${dest}/helm-charts.txt
+ """
+}
diff --git a/vars/volthaDeploy.groovy b/vars/volthaDeploy.groovy
index 29d090e..5b0adc3 100644
--- a/vars/volthaDeploy.groovy
+++ b/vars/volthaDeploy.groovy
@@ -17,6 +17,7 @@
extraHelmFlags: "",
localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org"
+ kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
]
if (!config) {
diff --git a/vars/volthaInfraDeploy.groovy b/vars/volthaInfraDeploy.groovy
index 4f828fd..d92861e 100644
--- a/vars/volthaInfraDeploy.groovy
+++ b/vars/volthaInfraDeploy.groovy
@@ -20,6 +20,7 @@
workflow: "att",
extraHelmFlags: "",
localCharts: false,
+ kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
]
if (!config) {
@@ -42,11 +43,16 @@
println "Deploying VOLTHA Infra with the following parameters: ${cfg}."
+ def kubeconfig = cfg.kubeconfig
+ if (kubeconfig == null) {
+ kubeconfig = env.KUBECONFIG
+ }
+
sh """
kubectl create namespace ${cfg.infraNamespace} || true
- kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=$KUBECONFIG" || true
+ kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=${kubeconfig}" || true
"""
- // TODO support multiple replicas
+
sh """
helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra ${volthaInfraChart} \
--set onos-classic.replicas=${cfg.onosReplica},onos-classic.atomix.replicas=${cfg.atomixReplica} \