Add possibility to clean up unused ns
* if test fails then ns is not deleted automatically that is why
we have the situation that gke cluster has a lot of old pods
in namespaces which were used for failed tests
@@ -47,6 +47,10 @@ wait_cluster_consistency() {
}
create_namespace() {
+ if [ "${CLEAN_NAMESPACE}" == 1 ]; then
+ kubectl get ns | egrep -v "^kube-|^default|Terminating|^NAME" | awk '{print$1}' | xargs kubectl delete ns
+ fi
+
local namespace="$1"
if [ "$OPENSHIFT" == 1 ]; then
oc delete project "$namespace" && sleep 40 || :
