@@ -115,17 +115,84 @@ statically in the guest.
115
115
116
116
## Proposal
117
117
118
- This section should explain what the proposal actually is. Enumerate
119
- * all* of the proposed changes at a * high level* , including all of the
120
- components that need to be modified and how they will be
121
- different. Include the reason for each choice in the design and
122
- implementation that is proposed here.
123
-
124
- To keep this section succinct, document the details like API field
125
- changes, new images, and other implementation details in the
126
- ** Implementation Details** section and record the reasons for not
127
- choosing alternatives in the ** Alternatives** section at the end of
128
- the document.
118
+ This proposal to import VMs from other virtualization platforms while
119
+ preserving their networking configuration will impact three different OpenShift
120
+ components:
121
+ - MTV
122
+ - KubeVirt's ipam-extensions
123
+ - OVN-Kubernetes
124
+
125
+ We will elaborate the overall flow first, before digging into details in each
126
+ of the components.
127
+
128
+ MTV currently introspects the VM to learn the MAC addresses of the interfaces,
129
+ and templates the VM which will be created in OpenShift Virtualization with the
130
+ required MAC address. We would need MTV to somehow also figure out what IP
131
+ addresses are on the aforementioned interfaces.
132
+
133
+ A new CRD - named ` IPPool ` , or ` DHCPLeaseConfig ` (or the like) - will be
134
+ created, and is associated to a UDN (both UDN, and C-UDN). This CRD holds the
135
+ association of MAC address to IPs for a UDN. When importing the VM into
136
+ OpenShift Virt, MTV will provision / update this object with this information.
137
+ This object is providing to the admin user a single place to check the IP
138
+ address MAC to IPs mapping. On an first implementation phase, we can have the
139
+ admin provision these CRs manually. Later on, MTV (or any other cluster
140
+ introspection tool can provision these on behalf of the admin).
141
+
142
+ The ` ipam-extensions ` mutating webhook will kick in whenever a virt launcher
143
+ pod is created - it will identify when the VM has a primary UDN attachment
144
+ (already happens today), and will also identify when the pod network attachment
145
+ has a MAC address configuration request.
146
+ It will then access the ` IPPool ` (or ` DHCPLeaseConfig ` for the UDN) to extract
147
+ which IP addresses are assigned to said MAC address.
148
+ Finally, the ` ipam-extensions ` mutating webhook will mutate the launcher pod to
149
+ customize the primary UDN attachment using the multus default network
150
+ annotation. This annotation (with an associated example) would look like:
151
+ ``` yaml
152
+ apiVersion : v1
153
+ kind : Pod
154
+ metadata :
155
+ name : pod-example
156
+ annotations :
157
+ v1.multus-cni.io/default-network : ' {
158
+ "name": "isolated-net",
159
+ "namespace": "myisolatedns",
160
+ "mac": "02:03:04:05:06:07",
161
+ "ips": [
162
+ "192.0.2.20/24",
163
+ "fd90:1234::14/64"
164
+ ]
165
+ }'
166
+ ` ` `
167
+
168
+ OVN-Kubernetes will then act upon this information, by configuring the
169
+ requested MAC and IPs in the pod. If the allocation of the IP is successful,
170
+ said IPs will be persisted in the corresponding ` IPAMClaim` CR (which already
171
+ happens today). If it fails (e.g. that IP address is already in use in the
172
+ subnet), the CNI will fail, crash-looping the pod. The error condition will be
173
+ reported in the associated `IPAMClaim` CR, and an event logged in the pod.
174
+
175
+ This flow is described in the following sequence diagram :
176
+ ` ` ` mermaid
177
+ sequenceDiagram
178
+ actor Admin
179
+ actor VM Owner
180
+
181
+ participant MTV
182
+ participant CNV
183
+ participant o as OVN-Kubernetes
184
+
185
+ Admin ->> CNV: provision IPPool
186
+ CNV -->> Admin: OK
187
+
188
+ VM Owner ->> MTV: import VM
189
+ MTV ->> CNV: create VM(name=<...>, primaryUDNMac=origMAC)
190
+ CNV ->> CNV: ips = getIPsForMAC(mac=origMAC)
191
+ CNV ->> o: create pod(mac=origMAC, IPs=ips)
192
+ o -->> CNV: OK
193
+ CNV -->> MTV: OK
194
+ MTV -->> VM Owner: OK
195
+ ` ` `
129
196
130
197
# ## Workflow Description
131
198
0 commit comments