summaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authoryuryn <Yury.Novitsky@Amdocs.com>2017-10-15 19:07:29 +0300
committeryuryn <Yury.Novitsky@Amdocs.com>2017-10-15 19:44:05 +0300
commit715e36b956881b55bc24f8c8eed1d60eaf744dfa (patch)
treed1ba42471abe6f2ab89c38dbc9a58c7871462000 /kubernetes
parent11982f730eac0b01f883c5d718428ae26c28ce69 (diff)
No-wait namespace deletion option in deleteAll
- New option for deleteAll script. Allows to suppress waiting for namespace deletion. - Additionally, optimization to the waiting for namespace deletion - moved to the end of the script. Change-Id: I59e25714f215eed5b0ec740e08f6b7f00d26483c Issue-ID: OOM-361 Signed-off-by: yuryn <Yury.Novitsky@Amdocs.com>
Diffstat (limited to 'kubernetes')
-rwxr-xr-xkubernetes/oneclick/deleteAll.bash33
1 files changed, 27 insertions, 6 deletions
diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash
index 53f2d4d9fa..cdc651b1a9 100755
--- a/kubernetes/oneclick/deleteAll.bash
+++ b/kubernetes/oneclick/deleteAll.bash
@@ -5,11 +5,6 @@
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 "Namespace $_NS deleted.\n\n"
}
delete_service_account() {
@@ -25,6 +20,24 @@ delete_app_helm() {
helm delete $1-$2 --purge
}
+wait_terminate() {
+ printf "Waiting for namespaces termination...\n"
+ 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
+ _STATUS=1
+ break
+ fi
+ done
+ if [ "$_STATUS" -eq "0" ]; then
+ break
+ fi
+ sleep 2
+ done
+}
+
usage() {
cat <<EOF
Usage: $0 [PARAMs]
@@ -34,6 +47,7 @@ Usage: $0 [PARAMs]
from the following choices:
sdc, aai ,mso, message-router, robot, vid, aaf
sdnc, portal, policy, appc, multicloud, clamp, consul, vnfsdk
+-N : Do not wait for deletion of namespace and its objects
EOF
}
@@ -41,8 +55,9 @@ EOF
NS=
INCL_SVC=false
APP=
+WAIT_TERMINATE=true
-while getopts ":n:u:s:a:" PARAM; do
+while getopts ":n:u:s:a:N" PARAM; do
case $PARAM in
u)
usage
@@ -58,6 +73,9 @@ while getopts ":n:u:s:a:" PARAM; do
exit 1
fi
;;
+ N)
+ WAIT_TERMINATE=false
+ ;;
?)
usage
exit
@@ -85,5 +103,8 @@ for i in ${HELM_APPS[@]}; do
done
+if $WAIT_TERMINATE; then
+ wait_terminate $NS
+fi
printf "\n********** Gone **********\n"