Skip to content

Commit

Permalink
fix: cleanup.sh (#3569)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <zhangbingbing2_yewu@cmss.chinamobile.com>
  • Loading branch information
bobz965 committed Mar 22, 2024
1 parent 350eabb commit 7d634ba
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dist/images/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -eu
set -eux
export PS4='+ $(date "+%Y-%m-%d %H:%M:%S")\011 '

kubectl delete --ignore-not-found ds kube-ovn-pinger -n kube-system
# ensure kube-ovn-pinger has been deleted
Expand Down Expand Up @@ -126,7 +127,6 @@ kubectl delete --ignore-not-found sa vpc-dns -n kube-system
kubectl delete --ignore-not-found crd \
htbqoses.kubeovn.io \
security-groups.kubeovn.io \
ips.kubeovn.io \
ippools.kubeovn.io \
vpc-nat-gateways.kubeovn.io \
vpcs.kubeovn.io \
Expand All @@ -145,6 +145,15 @@ kubectl delete --ignore-not-found crd \
ovn-eips.kubeovn.io \
qos-policies.kubeovn.io

# in case of ip not delete
set +e
for ip in $(kubectl get ip -o name); do
kubectl patch "$ip" --type='json' -p '[{"op": "replace", "path": "/metadata/finalizers", "value": []}]'
kubectl delete --ignore-not-found "$ip"
done
kubectl delete --ignore-not-found crd ips.kubeovn.io
set -e

# Remove annotations/labels in namespaces and nodes
kubectl annotate no --all ovn.kubernetes.io/cidr-
kubectl annotate no --all ovn.kubernetes.io/gateway-
Expand Down

0 comments on commit 7d634ba

Please sign in to comment.