aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/oneclick/deleteAll.bash
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/oneclick/deleteAll.bash')
-rwxr-xr-xkubernetes/oneclick/deleteAll.bash35
1 files changed, 20 insertions, 15 deletions
diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash
index 53f1d1a9cb..9833af7909 100755
--- a/kubernetes/oneclick/deleteAll.bash
+++ b/kubernetes/oneclick/deleteAll.bash
@@ -3,17 +3,15 @@
. $(dirname "$0")/setenv.bash
delete_namespace() {
- _NS=$1-$2
- kubectl delete namespace $_NS
+ kubectl delete namespace $1
}
delete_service_account() {
- kubectl delete clusterrolebinding $1-$2-admin-binding
- printf "Service account $1-$2-admin-binding deleted.\n\n"
+ kubectl delete clusterrolebinding $1-admin-binding
}
delete_registry_key() {
- kubectl --namespace $1-$2 delete secret ${1}-docker-registry-key
+ kubectl --namespace $1 delete secret ${1}-docker-registry-key
}
delete_app_helm() {
@@ -25,13 +23,18 @@ wait_terminate() {
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 +63,7 @@ APP=
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 +79,7 @@ while getopts ":c:n:u:s:a:yN" PARAM; do
usage
exit 1
fi
+ SINGLE_COMPONENT=true
;;
N)
WAIT_TERMINATE=false
@@ -128,15 +132,16 @@ fi
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
+ delete_registry_key $NS
+ delete_service_account $NS
+fi
if $WAIT_TERMINATE; then
wait_terminate $NS