Skip to content

Commit

Permalink
skip clean control namespace in rerun (#2083)
Browse files Browse the repository at this point in the history
* skip clean control namespace in rerun

Signed-off-by: Allen Li <[email protected]>

* null value for CONTROL_NS

Signed-off-by: Allen Li <[email protected]>

---------

Signed-off-by: Allen Li <[email protected]>
  • Loading branch information
qpdpQ authored Jul 9, 2024
1 parent 4f67b85 commit 64d88a1
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions cp3pt0-deployment/uninstall_tenant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OC=oc
YQ=yq
TENANT_NAMESPACES=""
OPERATOR_NS_LIST=""
CONTROL_NS=""
FORCE_DELETE=0
DEBUG=0

Expand Down Expand Up @@ -369,24 +370,28 @@ function cleanup_cs_control() {
title "Clean up control namespace"
msg "-----------------------------------------------------------------------"
get_control_namespace
# cleanup namespaceScope in Control namespace
cleanup_NamespaceScope $CONTROL_NS
# cleanup webhook
cleanup_webhook $CONTROL_NS ""
# cleanup secretshare
cleanup_secretshare $CONTROL_NS ""
# cleanup crossplane
cleanup_crossplane
# delete common-service-maps
${OC} delete configmap common-service-maps -n kube-public
# delete namespace
${OC} delete --ignore-not-found ns "$CONTROL_NS" --timeout=30s
if [ $? -ne 0 ] || [ $FORCE_DELETE -eq 1 ]; then
warning "Failed to delete namespace $CONTROL_NS, force deleting remaining resources..."
remove_all_finalizers $ns && success "Namespace $CONTROL_NS is deleted successfully."
fi
if [[ "${CONTROL_NS}" == "null" ]] || [[ "${CONTROL_NS}" == "" ]]; then
info "control_namespace not found"
else
# cleanup namespaceScope in Control namespace
cleanup_NamespaceScope $CONTROL_NS
# cleanup webhook
cleanup_webhook $CONTROL_NS ""
# cleanup secretshare
cleanup_secretshare $CONTROL_NS ""
# cleanup crossplane
cleanup_crossplane
# delete common-service-maps
${OC} delete configmap common-service-maps -n kube-public
# delete namespace
${OC} delete --ignore-not-found ns "$CONTROL_NS" --timeout=30s
if [ $? -ne 0 ] || [ $FORCE_DELETE -eq 1 ]; then
warning "Failed to delete namespace $CONTROL_NS, force deleting remaining resources..."
remove_all_finalizers $ns && success "Namespace $CONTROL_NS is deleted successfully."
fi

success "Control namespace: ${CONTROL_NS} is cleanup"
success "Control namespace: ${CONTROL_NS} is cleanup"
fi
fi

}
Expand Down

0 comments on commit 64d88a1

Please sign in to comment.