Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #168 from wallrj/157-delete-namespace-now
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Delete namespaces immediately, without waiting for pods to stop

* Use `kubectl delete --now` to ensure fast deletion of namespaces between tests.

Fixes: #157
**Release note**:
```release-note
NOW
```
  • Loading branch information
jetstack-ci-bot authored Dec 13, 2017
2 parents 2c02864 + 33ecca1 commit 8552009
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions hack/libe2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,30 @@ function retry() {

function kube_delete_namespace_and_wait() {
local namespace=$1
# Delete all the resources in the namespace
# This is a work around for Kubernetes 1.7 which doesn't support garbage
# collection of resources owned by third party resources.
# See https://github.com/kubernetes/kubernetes/issues/44507
if ! retry kubectl --namespace "${namespace}" \
delete \
services,serviceaccounts,roles,rolebindings,statefulsets,pods \
--now \
--all
then
# If multiple attempts to delete resources fails, display the remaining
# resources.
kubectl cluster-info dump --namespaces "${namespace}" || true
return 1
fi
# Delete any previous namespace and wait for Kubernetes to finish deleting.
kubectl delete namespace "${namespace}" || true
retry TIMEOUT=300 not kubectl get namespace ${namespace}
kubectl delete --now namespace "${namespace}" || true
if ! retry TIMEOUT=300 not kubectl get namespace ${namespace}; then
# If the namespace doesn't delete in time, display the remaining
# resources.
kubectl cluster-info dump --namespaces "${namespace}" || true
return 1
fi
return 0
}

function kube_event_exists() {
Expand Down

0 comments on commit 8552009

Please sign in to comment.