Skip to content

Commit

Permalink
fix: reuse node ip and mac annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed May 6, 2019
1 parent fa20676 commit 8f96267
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
23 changes: 23 additions & 0 deletions dist/images/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/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-
20 changes: 11 additions & 9 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3. Reboot the Node to remove ipset/iptables rules and nics.
5 changes: 4 additions & 1 deletion pkg/controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8f96267

Please sign in to comment.