[VOL-4252] Parsing ETCD by label and waiting for ONOS to start with new config loader

Change-Id: I22a03fab27ebfc5acbb1ed57ab7667135f5185dc
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
+    """
 }