From a106e7fe0690185513dd0eaa339cce01ed6bbe6b Mon Sep 17 00:00:00 2001 From: bobz965 Date: Fri, 22 Dec 2023 16:07:15 +0800 Subject: [PATCH] fix: cleanup.sh (#3569) Signed-off-by: bobz965 --- dist/images/cleanup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dist/images/cleanup.sh b/dist/images/cleanup.sh index f06873dd305..328897b7c43 100644 --- a/dist/images/cleanup.sh +++ b/dist/images/cleanup.sh @@ -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 @@ -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 \ @@ -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-