Seed code for the Plugin
[ovn4nfv-k8s-plugin.git] / README.rst
1 .. Copyright 2018 Intel Corporation.
2    Licensed under the Apache License, Version 2.0 (the "License");
3    you may not use this file except in compliance with the License.
4    You may obtain a copy of the License at
5         http://www.apache.org/licenses/LICENSE-2.0
6    Unless required by applicable law or agreed to in writing, software
7    distributed under the License is distributed on an "AS IS" BASIS,
8    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9    See the License for the specific language governing permissions and
10    limitations under the License.
11
12 =================
13 OVN4NFVK8s Plugin
14 =================
15
16 Problem statement
17 -----------------
18
19 Networking applications are of three types - Management applications,
20 Control plane applications and  data plane applications. Management
21 and control plane applications are similar to Enterprise applications,
22 but data plane applications different in following aspects:
23
24 - Multiple virtual network interfaces
25 - Multiple IP addresses
26 - SRIOV networking support
27 - Programmable virtual switch (for service function chaining, to tap
28   the traffic for visibility etc..)
29
30 Kubernetes (Simply K8S) is the most popular container orchestrator.
31 K8S is supported by GCE, AZURE and AWS and will be supported by
32 Akraino Edge stack that enable edge clouds.
33
34 K8S has being enhanced to support VM workload types, this helps
35 cloud providers that need to migrate legacy workloads to microservices
36 architecture. Cloud providers may continue to support VM workload
37 types for security reasons and hence there is need for VIM that
38 support both VMs and containers. Since same K8S instance can
39 orchestrate both VM and container workload types, same compute nodes
40 can be leveraged for both VMs and containers. Telco and CSPs are
41 seeing similar need to deploy networking applications as containers.
42
43 Since, both VMs and container workloads are used for networking
44 applications, there would be need for
45
46 - Sharing the networks across VMs and containers.
47 - Sharing the volumes across VMs and containers.
48
49 **Network Function Virtualization Requirements**
50
51 NFV workloads can be,
52
53 - Management plane workloads
54 - Control plane work loads
55 - User plane (data plane workloads)
56 - User plane workloads normally have
57 - Multiple interfaces, Multiple subnets, Multiple virtual networks
58 - NFV workloads typically have its own management network.
59 - Some data plane workloads require SR-IOV NIC support for data
60   interfaces and virtual NIC for other interfaces (for performance
61   reasons)
62 - Need for multiple CNIs.
63 - NFV workloads require dynamic creation of virtual networks. Dynamic
64   configuration of subnets.
65
66 New Proposal
67 ------------
68
69 A new plugin addressing the below requirements,
70
71 - For networking workloads as well typical application workloads
72 - Multi-interface support
73 - Multi-IP address support
74 - Dynamic creation of virtual networks
75 - Co-existing with SRIOV and other CNIs.
76 - Route management across virtual networks and external networks
77
78 **OVN Background**
79
80 OVN, the Open Virtual Network, is a system to support virtual network
81 abstraction. OVN complements the existing capabilities of OVS to add
82 native support for virtual network abstractions, such as virtual L2
83 and L3 overlays and security groups. Services such as DHCP are also
84 desirable features. Just like OVS, OVN’s design goal is to have a
85 production quality implementation that can operate at significant
86 scale. 
87
88 **K8S-OVN4NFV Plugin development**
89
90 Some code and ideas are being taken from ovn-kubernetes_ plugin
91 work that was done as part of OVN project.  Due to good number of
92 changes, it is a new plugin with its own code base.  This plugin
93 assumes that the first interface in a Pod is provided by some other
94 Plugin/CNI like Flannel or even OVN-Kubernetes and this plugin is
95 only responsible to add multiple interfaces based on the Pod
96 annotations. This plugin is currently tested to work with Multus as
97 CNI and Flannel as first interface.
98
99 Its functionality is divided into to following:
100
101 - Initialization:
102
103   - Register itself as watcher to K8S API Server to receive POD events
104     and service events.
105   - Creates a distributed router
106   - Creates gateway
107   - Creates a logical switch to connect distributed router with
108     Gateway.
109   - Creates a subnet between distributed router & Gateway.
110   - Assigns first two IP addresses of the subnet to router and
111     Gateway.
112   - Created router port and gateway port as part of assigning IP
113     address and MAC addresses.
114
115 - Watcher:
116
117   - Upon POD bring up event
118
119     - Checks the annotations specific to OVN.
120     - For each network on which POD is going to be brought up
121     - Validates whether the logical switch is already present. If not,
122       it is considered as error.
123     - If IP address and MAC addresses are not static, it asks OVN to
124       assign IP and MAC address.
125     - Collects all IP addresses/MAC addresses assigned. Puts them as
126       annotations (dynamic information) for that POD.
127
128   - Upon POD deletion event
129
130     - Returns the IP address and MAC address back to OVN pool.
131
132 - OVN CNI
133
134 This is present in every minion node. CNI is expected to be called
135 once for all OVN networks either Kubelet directly or via Multus.
136
137   - Add:
138
139     - Wait for annotations to be filled up by the watcher. From
140       annotations, it knows set  of IP Address, MAC address and Routes
141       to be added.
142     - Using network APIs for each element in the set:
143     - Creates veth pair.
144     - Assigns the IP address and MAC address to one end of veth pair.
145       Other end veth pair is assigned to br-int.
146     - Creates routes based on the route list provided in annotations.
147
148   - If isDefaultRoute is set in annotations, it creates default route
149     using this veth.
150   - Delete
151
152     - Removes veth pair.
153     - Removes routes.
154
155 **Figure**
156
157 .. code-block:: raw
158
159     +-----------------+
160     |                 |
161     |                 |   Program OVN Switch
162     |ovn4nfvk8s Plugin|                      +------------------+
163     |                 +--------------------->|                  |
164     |                 |                      | OVN Switch       |
165     |                 |                      |                  |
166     |                 |                      +------------------+
167     +----+----------+-+
168          ^          |
169          |          |
170          |On Event  |Annotate Pod
171          |          |
172          |          v
173     +----+--------------+        +------------------+           +-----------+
174     |                   |        |                  |           | Pod       |
175     |  Kube API         +-------->  Kube Scheduler  +---------->|           |
176     |                   |        |                  |           +--------+--+
177     |                   |        +--------+---------+                    |
178     +-------------------+                 |                              |
179                                           |                              |
180                                           |                              |Assign IP & MAC
181                                  +--------v-----------+                  |
182                                  |                    |                  |
183                                  | ovn4nfvk8s-cni     |                  |
184                                  |                    +------------------+
185                                  +--------------------+
186
187
188    Complete Architecture can be found in ovn-kubernetes documentation at github
189
190
191 **References**
192
193 .. _ovn-kubernetes: https://wiki.opnfv.org/display/OV/K8S+OVN+NFV+Plugin
194
195 **Authors/Contributors**
196
197 Addepalli, Srinivasa R <srinivasa.r.addepalli@intel.com>
198 Sood, Ritu <ritu.sood@intel.com>