Commit 8f49f9e7 authored by MengxinLiu's avatar MengxinLiu Committed by oilbeater
Browse files

fix: cleanup in offline environment

No related merge requests found
Showing with 22 additions and 16 deletions
+22 -16
......@@ -2,26 +2,19 @@
set -eu
for subnet in $(kubectl get subnet -o name); do
kubectl patch "$subnet" --type='json' -p '[{"op": "remove", "path": "/metadata/finalizers"}]'
kubectl patch "$subnet" --type='json' -p '[{"op": "replace", "path": "/metadata/finalizers", "value": []}]'
done
# Delete Kube-OVN components
kubectl delete -f https://raw.githubusercontent.com/alauda/kube-ovn/master/yamls/kube-ovn.yaml --ignore-not-found=true
kubectl delete -f https://raw.githubusercontent.com/alauda/kube-ovn/master/yamls/ovn.yaml --ignore-not-found=true
kubectl delete -f https://raw.githubusercontent.com/alauda/kube-ovn/master/yamls/crd.yaml --ignore-not-found=true
kubectl delete cm ovn-config -n kube-system --ignore-not-found=true
kubectl delete sa ovn -n kube-system --ignore-not-found=true
kubectl delete clusterrole system:ovn --ignore-not-found=true
kubectl delete clusterrolebinding ovn --ignore-not-found=true
kubectl delete svc ovn-nb ovn-sb kube-ovn-pinger kube-ovn-controller kube-ovn-cni -n kube-system --ignore-not-found=true
kubectl delete deployment ovn-central kube-ovn-controller -n kube-system --ignore-not-found=true
kubectl delete ds ovs-ovn kube-ovn-cni kube-ovn-pinger -n kube-system --ignore-not-found=true
kubectl delete crd ips.kubeovn.io subnets.kubeovn.io --ignore-not-found=true
# Remove annotations in all pods of all namespaces
for ns in $(kubectl get ns -o name |cut -c 11-); do
echo "annotating pods in ns:$ns"
kubectl annotate pod --all ovn.kubernetes.io/cidr- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/gateway- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/ip_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/logical_switch- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/mac_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/port_name- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/allocated- -n "$ns"
done
# Remove annotations in namespaces and nodes
kubectl annotate no --all ovn.kubernetes.io/cidr-
kubectl annotate no --all ovn.kubernetes.io/gateway-
......@@ -35,3 +28,16 @@ kubectl annotate ns --all ovn.kubernetes.io/gateway-
kubectl annotate ns --all ovn.kubernetes.io/logical_switch-
kubectl annotate ns --all ovn.kubernetes.io/private-
kubectl annotate ns --all ovn.kubernetes.io/allow-
kubectl annotate ns --all ovn.kubernetes.io/allocated-
# Remove annotations in all pods of all namespaces
for ns in $(kubectl get ns -o name |cut -c 11-); do
echo "annotating pods in ns:$ns"
kubectl annotate pod --all ovn.kubernetes.io/cidr- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/gateway- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/ip_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/logical_switch- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/mac_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/port_name- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/allocated- -n "$ns"
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment