[VOL-4252] Parsing ETCD by label and waiting for ONOS to start with new config loader
Change-Id: I22a03fab27ebfc5acbb1ed57ab7667135f5185dc
diff --git a/jjb/pipeline/voltha/master/physical-build.groovy b/jjb/pipeline/voltha/master/physical-build.groovy
index 079ba91..f5a7d74 100644
--- a/jjb/pipeline/voltha/master/physical-build.groovy
+++ b/jjb/pipeline/voltha/master/physical-build.groovy
@@ -155,7 +155,7 @@
timeout(1) {
sh returnStatus: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
- etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
+ etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
if [[ "${workFlow}" == "TT" ]]; then
if [[ "${params.enableMultiUni}" == "true" ]]; then
kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-HSIA.json \$etcd_container:/tmp/hsia.json
@@ -185,7 +185,7 @@
timeout(1) {
sh returnStatus: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
- etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
+ etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64'
"""
}
@@ -198,7 +198,7 @@
steps {
sh """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
- etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
+ etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json
kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Alpha.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/go_templates/BRCM/BVM4K00BRA0915-0083/5023_020O02414'
kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Alpha.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/templates/BRCM/BVM4K00BRA0915-0083/5023_020O02414'
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
index 4416ae4..3f381f5 100644
--- a/vars/volthaStackDeploy.groovy
+++ b/vars/volthaStackDeploy.groovy
@@ -88,9 +88,10 @@
"""
// also make sure that the ONOS config is loaded
- // NOTE that this is only required for VOLTHA-2.8, 2.9 switched to a Deployment
+ // NOTE that this is only required for VOLTHA-2.8
println "Wait for ONOS Config loader to complete"
+ // NOTE that this is only required for VOLTHA-2.8,
sh """
set +x
config=\$(kubectl get jobs.batch -n ${cfg.infraNamespace} --no-headers | grep "0/" | wc -l)
@@ -99,4 +100,14 @@
config=\$(kubectl get jobs.batch -n ${cfg.infraNamespace} --no-headers | grep "0/" | wc -l)
done
"""
+ // NOTE that this is only required for VOLTHA-2.9 onwards, to wait until the pod completed,
+ //meaning ONOS fully deployed
+ sh """
+ set +x
+ config=\$(kubectl get pods -l app=onos-config-loader -n ${cfg.infraNamespace} --no-headers | grep "0/" | wc -l)
+ while [[ \$config != 0 ]]; do
+ sleep 5
+ config=\$(kubectl get pods -l app=onos-config-loader -n ${cfg.infraNamespace} --no-headers | grep "0/" | wc -l)
+ done
+ """
}