2424# DELETE_FILES Delete local test files, and launch a job to delete PV
2525# hosted test files (default true).
2626#
27+ # FAST_DELETE Set to "--grace-period=1 --timeout=1" to speedup
28+ # deletes and skip phase 2.
29+ #
2730# --------------------
2831# Detailed Description
2932# --------------------
@@ -98,13 +101,13 @@ function deleteWithOneLabel {
98101 getResWithLabel $1
99102 # delete namespaced types
100103 cat $1 | awk ' { print $4 }' | grep -v " ^$" | sort -u | while read line; do
101- kubectl -n $line delete $NAMESPACED_TYPES -l " $LABEL_SELECTOR "
104+ kubectl $FAST_DELETE -n $line delete $NAMESPACED_TYPES -l " $LABEL_SELECTOR "
102105 done
103106
104107 # delete non-namespaced types
105108 local no_namespace_count=` grep -c -v " -n " $1 `
106109 if [ ! " $no_namespace_count " = " 0" ]; then
107- kubectl delete $NOT_NAMESPACED_TYPES -l " $LABEL_SELECTOR "
110+ kubectl $FAST_DELETE delete $NOT_NAMESPACED_TYPES -l " $LABEL_SELECTOR "
108111 fi
109112
110113 echo " @@ Waiting for pods to stop running."
@@ -136,7 +139,7 @@ function deleteWithOneLabel {
136139function deleteNamespaces {
137140 cat $1 | awk ' { print $4 }' | grep -v " ^$" | sort -u | while read line; do
138141 if [ " $line " != " default" ]; then
139- kubectl delete namespace $line --ignore-not-found
142+ kubectl $FAST_DELETE delete namespace $line --ignore-not-found
140143 fi
141144 done
142145
@@ -246,7 +249,7 @@ function genericDelete {
246249 return 0
247250 fi
248251
249- if [ " $iteration " = " first" ]; then
252+ if [ " $iteration " = " first" ] && [ " $FAST_DELETE " = " " ] ; then
250253 # in the first iteration we just wait to see if artifacts go away on there own
251254
252255 echo " @@ Waiting for $artcount_total artifacts to delete. Wait time $(( mnow - mstart)) seconds (max=$maxwaitsecs ). Waiting for:"
@@ -269,8 +272,8 @@ function genericDelete {
269272
270273 if [ ${artcount_no} -gt 0 ]; then
271274 cat " $resfile_no " | while read line; do
272- echo " kubectl delete $line --ignore-not-found"
273- kubectl delete $line --ignore-not-found
275+ echo " kubectl $FAST_DELETE delete $line --ignore-not-found"
276+ kubectl $FAST_DELETE delete $line --ignore-not-found
274277 done
275278 fi
276279
@@ -292,9 +295,9 @@ function genericDelete {
292295}
293296
294297function cleanup_tiller {
295- kubectl -n kube-system delete deployment tiller-deploy --ignore-not-found=true
296- kubectl delete clusterrolebinding tiller-cluster-rule --ignore-not-found=true
297- kubectl -n kube-system delete serviceaccount tiller --ignore-not-found=true
298+ kubectl $FAST_DELETE -n kube-system delete deployment tiller-deploy --ignore-not-found=true
299+ kubectl $FAST_DELETE delete clusterrolebinding tiller-cluster-rule --ignore-not-found=true
300+ kubectl $FAST_DELETE -n kube-system delete serviceaccount tiller --ignore-not-found=true
298301}
299302
300303function fail {
0 commit comments