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

fix: reuse node ip and mac annotation

parent fa206768
No related merge requests found
Showing with 38 additions and 10 deletions
+38 -10
#!/bin/bash
set -euo pipefail
# Remove finalizers in svc
kubectl patch svc -n kube-ovn ovn-nb --type='json' -p '[{"op": "replace", "path": "/metadata/finalizers", "value": []}]'
kubectl patch svc -n kube-ovn ovn-sb --type='json' -p '[{"op": "replace", "path": "/metadata/finalizers", "value": []}]'
# Delete Kube-OVN components
kubectl delete ns kube-ovn
# Remove annotations in namespaces and nodes
kubectl annotate no --all ovn.kubernetes.io/cidr-
kubectl annotate no --all ovn.kubernetes.io/gateway-
kubectl annotate no --all ovn.kubernetes.io/ip_address-
kubectl annotate no --all ovn.kubernetes.io/logical_switch-
kubectl annotate no --all ovn.kubernetes.io/mac_address-
kubectl annotate no --all ovn.kubernetes.io/port_name-
kubectl annotate ns --all ovn.kubernetes.io/cidr-
kubectl annotate ns --all ovn.kubernetes.io/exclude_ips-
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-
......@@ -25,23 +25,25 @@ For high-available ovn db, see [high available](high-available.md)
### Controller Configuration
```bash
--default-cidr: Default CIDR for Namespaces with no logical switch annotation, default: 10.16.0.0/16
--node-switch-cidr: The CIDR for the Node switch. Default: 100.64.0.0/16
```
```bash
--default-cidr: Default CIDR for Namespaces with no logical switch annotation, default: 10.16.0.0/16
--node-switch-cidr: The CIDR for the Node switch. Default: 100.64.0.0/16
```
## To uninstall
1. Remove finalizers in svc kube-ovn/ovn-sb and kube-ovn/ovn-nb.
1. Remove Kubernetes resources:
2. Delete Kube-OVN components:
```bash
wget https://raw.githubusercontent.com/alauda/kube-ovn/master/dist/images/cleanup.sh
bash cleanup.sh
```
`kubectl delete ns kube-ovn`
3. Delete OVN/OVS DB and config files on every Node:
2. Delete OVN/OVS DB and config files on every Node:
```bash
rm -rf /var/run/openvswitch
rm -rf /etc/origin/openvswitch/
rm -rf /etc/openvswitch
```
4. Reboot the Node to remove ipset/iptables rules and nics.
\ No newline at end of file
3. Reboot the Node to remove ipset/iptables rules and nics.
\ No newline at end of file
......@@ -124,7 +124,10 @@ func (c *Controller) handleAddNode(key string) error {
return err
}
nic, err := c.ovnClient.CreatePort(c.config.NodeSwitch, fmt.Sprintf("node-%s", key), "", "")
nic, err := c.ovnClient.CreatePort(
c.config.NodeSwitch, fmt.Sprintf("node-%s", key),
node.Annotations[util.IpAddressAnnotation],
node.Annotations[util.MacAddressAnnotation])
if err != nil {
return err
}
......
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