Networking Plugin
The Networking Plugin has the ability to create, delete, query and update virtual networks. This will implement API's like CreateVL, DeleteVL, QueryVL and UpdateVL. Networking plugin on initialization will call discovery function to find out about the type of networking plugin available. It'll load the required plugin and call init functions of the appropriate plugin.
...
- Figure out if the virtual network already exists. Use the ovn-nbctl call to figure that out. If already exist skip next step.
- Create Logical switch with name as provided in input and other-config:subnet=<Subnet-IP> set to the subnet required for the virtual network and external-ids:gateway_ip=<Gateway-IP> set to the gateway IP for the virtual network.
- Check if the virtual network is attached to the distributed router if not attach virtual network to the distributed router.
- Return success if initialization is successful
Multus Integration
One of the requirements for VNF's is to support multiple virtual network interfaces and multiple IP addresses. Multus acts as a Multi plugin in Kubernetes and provides the multiple network interface support in a pod. https://github.com/intel/multus-cni. It'll be used in this project to provide a default management port based on Flannel to all VNF's. The other interfaces will all be based on ovn-kubernetes as discussed in the next section.
Ovn-kubernetes design and changes for multiple interface support
- ovn-kubernetes current design doesn't support multiple interfaces and also a single default network created at the time initialization time and all pods are connected to that.
- In the current design of ovn-kubernetes if a Pod is annotated with "ovn" then static IP, MAC can be assigned for the single interface that is created. And if the pod is not annotated with "ovn" then the ovn watcher annotates the pod with the "ovn" with dynamic address allocation. This information is then used by CNI to assign address for the interface. For backward compatibility this behavior will not change and pods can be created with single interface as before. The one interface is attached to a default network created at the time initialization time.
- To create multiple interface the pods or to attach single interface to a different virtual network a new annotation is added to the Pods - "ovnNetwork". If "ovnNetwork" annotation is present then the "ovn " annotation is ignored.
- Assumption CreateVL call is already made prior pod getting created with that virtual network.
- To create a pod with multiple interfaces annotate the pod like below:
...