@@ -46,22 +46,37 @@ dump_cluster_information() {
46
46
fi
47
47
}
48
48
49
- delete_operator () {
49
+ cleanup_operator () {
50
50
local context=" ${1} "
51
- timeout 5s helm uninstall --kube-context=" ${context} " mongodb-kubernetes-operator || true
51
+ if ! timeout 5s helm uninstall --wait --kube-context=" ${context} " mongodb-kubernetes-operator; then
52
+ echo " Warning: Helm uninstall failed or timed out. Continuing anyway."
53
+ fi
52
54
}
53
55
54
56
cleanup_openshift_cluster (){
55
- if [[ " ${TEST_RESULTS} " -ne 0 ]]; then
56
- # Mark namespace as failed to be cleaned later
57
- kubectl label " namespace/${NAMESPACE} " " evg/state=failed" --overwrite=true
58
-
59
- if [ " ${ALWAYS_REMOVE_TESTING_NAMESPACE-} " = " true" ]; then
60
- # Failed namespaces might cascade into more failures if the namespaces
61
- # are not being removed soon enough.
62
- reset_namespace " $( kubectl config current-context) " " ${NAMESPACE} " || true
63
- fi
57
+ if [[ " ${TEST_RESULTS} " -ne 0 ]]; then
58
+ # Mark namespace as failed to be cleaned later
59
+ kubectl label " namespace/${NAMESPACE} " " evg/state=failed" --overwrite=true
60
+
61
+ if [ " ${ALWAYS_REMOVE_TESTING_NAMESPACE-} " = " true" ]; then
62
+ # Failed namespaces might cascade into more failures if the namespaces
63
+ # are not being removed soon enough.
64
+ reset_namespace " $( kubectl config current-context) " " ${NAMESPACE} " || true
65
+ fi
66
+ else
67
+ if [[ " ${KUBE_ENVIRONMENT_NAME} " = " multi" ]]; then
68
+ echo " Tearing down cluster ${CENTRAL_CLUSTER} "
69
+ reset_namespace " ${CENTRAL_CLUSTER} " " ${NAMESPACE} " || true
70
+
71
+ for member_cluster in ${MEMBER_CLUSTERS} ; do
72
+ echo " Tearing down cluster ${member_cluster} "
73
+ reset_namespace " ${member_cluster} " " ${NAMESPACE} " || true
74
+ done
75
+ else
76
+ # If the test pass, then the namespace is removed
77
+ reset_namespace " $( kubectl config current-context) " " ${NAMESPACE} " || true
64
78
fi
79
+ fi
65
80
}
66
81
67
82
if [[ -n " ${KUBECONFIG:- } " && ! -f " ${KUBECONFIG} " ]]; then
@@ -145,16 +160,11 @@ if [[ "${CLUSTER_TYPE}" == "openshift" ]]; then
145
160
cleanup_openshift_cluster
146
161
else
147
162
if [[ " ${KUBE_ENVIRONMENT_NAME} " == " multi" ]]; then
148
- echo " Tearing down cluster ${CENTRAL_CLUSTER} "
149
- reset_namespace " ${CENTRAL_CLUSTER} " " ${NAMESPACE} " || true
150
-
151
- for member_cluster in ${MEMBER_CLUSTERS} ; do
152
- echo " Tearing down cluster ${member_cluster} "
153
- reset_namespace " ${member_cluster} " " ${NAMESPACE} " || true
154
- done
163
+ echo " Tearing down operator on ${CENTRAL_CLUSTER} "
164
+ cleanup_operator " ${CENTRAL_CLUSTER} "
155
165
else
156
166
# If the test passed, then the namespace is removed
157
- reset_namespace " $( kubectl config current-context) " " ${NAMESPACE} " || true
167
+ cleanup_operator " $( kubectl config current-context) "
158
168
fi
159
169
fi
160
170
0 commit comments