Run all components in one namespace

Change-Id: I5fcd4d577c1fda4de27842807c7cf7a5d372756e
Issue-ID: OOM-722
Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com>
diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash
index 53f1d1a..52748bc 100755
--- a/kubernetes/oneclick/deleteAll.bash
+++ b/kubernetes/oneclick/deleteAll.bash
@@ -3,8 +3,7 @@
 . $(dirname "$0")/setenv.bash
 
 delete_namespace() {
-  _NS=$1-$2
-  kubectl delete namespace $_NS
+  kubectl delete namespace $1
 }
 
 delete_service_account() {
@@ -25,13 +24,18 @@
   while true; do
     declare -i _STATUS=0
     for i in ${HELM_APPS[@]}; do
-      kubectl get namespaces $1-$i > /dev/null 2>&1
-      if [ "$?" -eq "0" ]; then
+      kubectl get pods --namespace $1 | grep -w " $i" > /dev/null 2>&1
+      if [ "$?" -ne "0" ]; then
         _STATUS=1
         break
       fi
     done
-    if [ "$_STATUS" -eq "0" ]; then
+
+    if [ "$SINGLE_COMPONENT" == "false" ]; then
+      kubectl get namespaces $1 > /dev/null 2>&1
+      _STATUS=$?
+    fi
+    if [ "$_STATUS" -ne "0" ]; then
       break
     fi
     sleep 2
@@ -60,7 +64,7 @@
 WAIT_TERMINATE=true
 SKIP_INTERACTIVE_CONFIRMATION=no
 KUBECTL_CONTEXT=
-
+SINGLE_COMPONENT=false
 while getopts ":c:n:u:s:a:yN" PARAM; do
   case $PARAM in
     u)
@@ -76,6 +80,7 @@
         usage
         exit 1
       fi
+      SINGLE_COMPONENT=true
       ;;
     N)
       WAIT_TERMINATE=false
@@ -128,15 +133,15 @@
 printf "\n********** Cleaning up ONAP: ${ONAP_APPS[*]}\n"
 
 for i in ${HELM_APPS[@]}; do
-
   delete_app_helm $NS $i
-  delete_namespace $NS $i
   delete_service_account $NS $i
-
 done
 
-delete_app_helm $NS "config"
-kubectl delete namespace $NS
+if [ "$SINGLE_COMPONENT" == "false" ]
+then
+    delete_app_helm $NS "config"
+    delete_namespace $NS
+fi
 
 if $WAIT_TERMINATE; then
   wait_terminate $NS