diff options
author | BorislavG <Borislav.Glozman@amdocs.com> | 2018-02-27 15:04:26 +0000 |
---|---|---|
committer | Alexis de Talhouƫt <alexis.de_talhouet@bell.ca> | 2018-03-01 18:10:31 +0000 |
commit | 8bfc6cf8c3d338c84c48201f7a4f274958e721a9 (patch) | |
tree | 2e0e1a969afc6ae38f0a2f62cc1a36e184cb48e1 /kubernetes/oneclick/deleteAll.bash | |
parent | f0a34e22011b4323bbd6a51ad313d6e547808101 (diff) |
Run all components in one namespace
Change-Id: I5fcd4d577c1fda4de27842807c7cf7a5d372756e
Issue-ID: OOM-722
Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com>
Diffstat (limited to 'kubernetes/oneclick/deleteAll.bash')
-rwxr-xr-x | kubernetes/oneclick/deleteAll.bash | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash index 53f1d1a9cb..52748bc933 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 @@ 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 +64,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 +80,7 @@ while getopts ":c:n:u:s:a:yN" PARAM; do usage exit 1 fi + SINGLE_COMPONENT=true ;; N) WAIT_TERMINATE=false @@ -128,15 +133,15 @@ 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 +fi if $WAIT_TERMINATE; then wait_terminate $NS |