Revert "moving certs and keys to k8s secrets"
[oom.git] / kubernetes / oneclick / deleteAll.bash
index 3d54aa8..40d0701 100755 (executable)
@@ -5,19 +5,19 @@
 delete_namespace() {
   _NS=$1-$2
   kubectl delete namespace $_NS
-  printf "Waiting for namespace $_NS termination...\n"
-  while kubectl get namespaces $_NS > /dev/null 2>&1; do
-    sleep 2
-  done
+   printf "Waiting for namespace $_NS termination...\n"
+   while kubectl get namespaces $_NS > /dev/null 2>&1; do
+     sleep 2
+   done
   printf "Namespace $_NS deleted.\n\n"
 }
 
 delete_registry_key() {
-  kubectl --namespace $1-$2 delete secret onap-docker-registry-key
+  kubectl --namespace $1-$2 delete secret ${1}-docker-registry-key
 }
 
-delete_service() {
-  kubectl --namespace $1-$2 delete -f ../$2/all-services.yaml
+delete_app_helm() {
+  helm delete $1-$2 --purge
 }
 
 usage() {
@@ -25,7 +25,6 @@ usage() {
 Usage: $0 [PARAMs]
 -u                  : Display usage
 -n [NAMESPACE]      : Kubernetes namespace (required)
--s true             : Include services (default: false)
 -a [APP]            : Specify a specific ONAP component (default: all)
                       from the following choices:
                       sdc, aai ,mso, message-router, robot,
@@ -47,9 +46,6 @@ while getopts ":n:u:s:a:" PARAM; do
     n)
       NS=${OPTARG}
       ;;
-    s)
-      INCL_SVC=${OPTARG}
-      ;;
     a)
       APP=${OPTARG}
       if [[ -z $APP ]]; then
@@ -70,21 +66,16 @@ if [[ -z $NS ]]; then
 fi
 
 if [[ ! -z "$APP" ]]; then
-  ONAP_APPS=($APP)
+  HELM_APPS=($APP)
 fi
 
 printf "\n********** Cleaning up ONAP: ${ONAP_APPS[*]}\n"
 
-for i in ${ONAP_APPS[@]}; do
 
-  # delete the deployments
-  /bin/bash $i.sh $NS $i 'delete'
+for i in ${HELM_APPS[@]}; do
 
-  if [[ "$INCL_SVC" == true ]]; then
-    printf "\nDeleting services **********\n"
-    delete_service $NS $i
-    delete_namespace $NS $i
-  fi
+  delete_app_helm $NS $i
+  delete_namespace $NS $i
 
 done