Skip to content

Commit

Permalink
Fix deleting member cluster when deleting host cluster KubeSphere
Browse files Browse the repository at this point in the history
Signed-off-by: “Forest-L <[email protected]>
  • Loading branch information
Forest-L committed Jan 13, 2021
1 parent 4d6f4cd commit e1b78e1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions scripts/kubesphere-delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ do
helm list -n $namespaces | grep -v NAME | awk '{print $1}' | sort -u | xargs -r -L1 helm uninstall -n $namespaces
done

# delete kubefed
kubectl get cc -n kubesphere-system ks-installer -o jsonpath="{.status.multicluster}" | grep enable
if [[ $? -eq 0 ]]; then
helm uninstall -n kube-federation-system kubefed
kubectl delete ns kube-federation-system
fi


helm uninstall -n kube-system snapshot-controller

# delete kubesphere deployment
Expand Down Expand Up @@ -58,6 +66,13 @@ do
delete_roles $ns
done

# delete clusters
for cluster in `kubectl get clusters -o jsonpath="{.items[*].metadata.name}"`
do
kubectl patch cluster $cluster -p '{"metadata":{"finalizers":null}}' --type=merge
done
kubectl delete clusters --all

# delete workspaces
for ws in `kubectl get workspaces -o jsonpath="{.items[*].metadata.name}"`
do
Expand All @@ -78,11 +93,6 @@ done

kubectl delete devopsprojects --all

# delete clusters
for cluster in `kubectl get clusters -o jsonpath="{.items[*].metadata.name}"`
do
kubectl patch cluster $cluster -p '{"metadata":{"finalizers":null}}' --type=merge
done

# delete validatingwebhookconfigurations
for webhook in ks-events-admission-validate users.iam.kubesphere.io validating-webhook-configuration
Expand Down

0 comments on commit e1b78e1

Please sign in to comment.