Update post-delete script and Add README.md
This commit is contained in:
@@ -78,6 +78,7 @@ done
|
||||
|
||||
echo "Removing Rancher bootstrap secret in the following namespace: ${rancher_namespace}"
|
||||
kubectl --ignore-not-found=true delete secret bootstrap-secret -n "${rancher_namespace}"
|
||||
kubectl --ignore-not-found=true delete secret tls-ca -n ${rancher_namespace}
|
||||
|
||||
echo "------ Summary ------"
|
||||
if [[ ${#succeeded[@]} -ne 0 ]]; then
|
||||
@@ -92,3 +93,27 @@ if [[ ${#failed[@]} -ne 0 ]]; then
|
||||
else
|
||||
echo "Cleanup finished successfully."
|
||||
fi
|
||||
|
||||
|
||||
for ns in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}'); do
|
||||
# Remove finalizers from the namespace itself
|
||||
kubectl patch namespace "$ns" -p '{"metadata":{"finalizers":[]}}' --type=merge
|
||||
|
||||
# Remove finalizers from all roles in the namespace
|
||||
for role in $(kubectl get roles -n "$ns" -o jsonpath='{.items[*].metadata.name}'); do
|
||||
kubectl patch role "$role" -n "$ns" -p '{"metadata":{"finalizers":[]}}' --type=merge
|
||||
done
|
||||
|
||||
# Remove finalizers from all rolebindings in the namespace
|
||||
for rolebinding in $(kubectl get rolebindings -n $ns -o jsonpath='{.items[*].metadata.name}'); do
|
||||
kubectl patch rolebinding "$rolebinding" -n "$ns" -p '{"metadata":{"finalizers":[]}}' --type=merge
|
||||
done
|
||||
done
|
||||
|
||||
for cr in $(kubectl get clusterroles -o jsonpath='{.items[*].metadata.name}'); do
|
||||
kubectl patch clusterrole "$cr" -p '{"metadata":{"finalizers":[]}}' --type=merge
|
||||
done
|
||||
|
||||
for crb in $(kubectl get clusterrolebindings -o jsonpath='{.items[*].metadata.name}'); do
|
||||
kubectl patch clusterrolebinding "$crb" -p '{"metadata":{"finalizers":[]}}' --type=merge
|
||||
done
|
||||
Reference in New Issue
Block a user