Skip to content

Commit

Permalink
wait for all pods to be deleted before deleting serviceaccount/cluste…
Browse files Browse the repository at this point in the history
…rrole/clusterrolebinding (#4035)

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed May 20, 2024
1 parent b772798 commit 3957427
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dist/images/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ kubectl delete --ignore-not-found deploy ovn-central -n kube-system
kubectl delete --ignore-not-found ds ovs-ovn -n kube-system
kubectl delete --ignore-not-found ds ovs-ovn-dpdk -n kube-system
kubectl delete --ignore-not-found secret kube-ovn-tls -n kube-system
kubectl delete --ignore-not-found sa ovn ovn-ovs kube-ovn-cni kube-ovn-app -n kube-system
kubectl delete --ignore-not-found clusterrole system:ovn system:ovn-ovs system:kube-ovn-cni system:kube-ovn-app
kubectl delete --ignore-not-found clusterrolebinding ovn ovn ovn-ovs kube-ovn-cni kube-ovn-app

# delete vpc-dns content
kubectl delete --ignore-not-found cm vpc-dns-config -n kube-system
Expand Down Expand Up @@ -190,6 +187,11 @@ while :; do
kubectl -n kube-system get pod -l component=network -o wide
done

# wait for all pods to be deleted before deleting serviceaccount/clusterrole/clusterrolebinding
kubectl delete --ignore-not-found sa ovn ovn-ovs kube-ovn-cni kube-ovn-app -n kube-system
kubectl delete --ignore-not-found clusterrole system:ovn system:ovn-ovs system:kube-ovn-cni system:kube-ovn-app
kubectl delete --ignore-not-found clusterrolebinding ovn ovn ovn-ovs kube-ovn-cni kube-ovn-app

# Remove annotations in all pods of all namespaces
for ns in $(kubectl get ns -o name | awk -F/ '{print $2}'); do
echo "annotating pods in namespace $ns"
Expand Down

0 comments on commit 3957427

Please sign in to comment.