Skip to content

Commit

Permalink
fix: cleanup.sh (#3569)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 authored Dec 22, 2023
1 parent a4c2237 commit a106e7f
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 @@ -127,7 +128,6 @@ kubectl delete --ignore-not-found sa vpc-dns -n kube-system
# delete CRD
kubectl delete --ignore-not-found crd \
security-groups.kubeovn.io \
ips.kubeovn.io \
ippools.kubeovn.io \
vpc-nat-gateways.kubeovn.io \
vpcs.kubeovn.io \
Expand All @@ -146,6 +146,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 a106e7f

Please sign in to comment.