Skip to content

Commit

Permalink
ci: No error if there are no terminating ns
Browse files Browse the repository at this point in the history
test/gke/delete-terminating-namespaces.sh was erroring out when there
were not terminating namespaces in cluster.

This change adds a check to the script that fixes that.

Signed-off-by: Maciej Kwiek <maciej@isovalent.com>
  • Loading branch information
nebril authored and raybejjani committed Feb 25, 2020
1 parent 9e30278 commit 9c055a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/gke/delete-terminating-namespaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

# because of https://github.com/kubernetes/kubernetes/issues/60807 , we may end up with garbage terminating
# namespaces leftovers after tests. This is a hacky workaround
kubectl get ns | grep Terminating | awk '{print $1}' | xargs -n 1 bash -c 'kubectl get ns -o json $1 | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$1/finalize -f -' -
kubectl get ns | \
awk '/Terminating/ {print $1}' | \
xargs -n 1 bash -c 'if [ "$#" -ne 1 ]; then exit 0; fi; kubectl get ns -o json $1 | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$1/finalize -f -' -

0 comments on commit 9c055a1

Please sign in to comment.