You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: design-proposals/network-binding-plugin/network-binding-plugin.md
+114Lines changed: 114 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -281,6 +281,56 @@ This solution was selected since it provides the cluster admin more control in r
281
281
282
282
For the alternative solutions please see [Appendix G](#appendix-g-alternatives-to-plugin-sidecar-container-resource-specification)
283
283
284
+
##### Compute Container Resource Overhead
285
+
286
+
For some plugins, an additional resource consumption can be expected from the virt-launcher pod compute container.
287
+
For example, there could be need to execute an additional binary in the compute container.
288
+
Since this binary has its own CPU and memory limits, they should be somehow accounted for.
289
+
Another example could be increased resource consumption of the virt-stack resulting from using the plugin.
290
+
291
+
Suggested solution:
292
+
293
+
Additional API for compute container resource overhead:
294
+
295
+
The network binding plugin API in the KubeVirt CR could receive an additional input field to specify the resource requirements overhead for the compute container:
296
+
297
+
```yaml
298
+
apiVersion: kubevirt.io/v1
299
+
kind: KubeVirt
300
+
metadata:
301
+
name: kubevirt
302
+
namespace: kubevirt
303
+
spec:
304
+
configuration:
305
+
network:
306
+
binding:
307
+
mynetbindingplugin:
308
+
sidecarImage: quay.io/kubevirt/mynetbindingplugin
309
+
computeResourceOverhead:
310
+
requests:
311
+
memory: 200Mi
312
+
```
313
+
314
+
If specified, KubeVirt will add the resource overhead specified in `computeResourceOverhead` to the compute container of the virt-launcher pod.
315
+
The specified resource overhead will be added to the compute container per unique usage of the plugin (not per NIC using the binding).
316
+
317
+
For example, assuming there is a plugin registered with a 200Mi memory overhead for the `compute` container, and
318
+
there are two interfaces using it.
319
+
`virt-controller`will only add 200Mi of memory to the `compute` container.
320
+
321
+
Pros:
322
+
- Cluster-wide definition of compute resource overhead per plugin.
323
+
- Additional resources could be requested other than CPU and memory.
324
+
- The resource overhead specification is visible to cluster admins.
325
+
326
+
Cons:
327
+
- Requires an API change.
328
+
- When upgrading KubeVirt / network binding plugin versions, the compute resource overhea specification might require adjustments.
329
+
330
+
This solution was selected since it provides the cluster admin more control in regard to resource allocation.
331
+
332
+
For the alternative solutions please see [Appendix H](#appendix-h-alternatives-to-compute-container-resource-overhead-specification)
333
+
284
334
#### Configure Pod netns
285
335
286
336
The CNI plugin has privileged access to the pod network namespace and
@@ -1262,3 +1312,67 @@ Cons:
1262
1312
1263
1313
This solution provides flexibility for plugin authors while keeping the network binding plugin API in KubeVirt small.
1264
1314
The requirement to maintain certificates for the webhook could be mitigated using tools such as [cert-manager](https://cert-manager.io/).
1315
+
1316
+
# Appendix H: Alternatives to compute container resource overhead specification
1317
+
1318
+
1. Manually setting the VM's resources:
1319
+
1320
+
Users could manually provide the additional memory overhead for the network binding plugin, under `spec.domain.resources.requests.memory`:
1321
+
1322
+
```yaml
1323
+
apiVersion: kubevirt.io/v1
1324
+
kind: VirtualMachine
1325
+
metadata:
1326
+
name: vm-cirros
1327
+
spec:
1328
+
template:
1329
+
spec:
1330
+
domain:
1331
+
memory:
1332
+
guest: 128Mi
1333
+
resources:
1334
+
requests:
1335
+
memory: 640Mi # 128Mi for the guest + 512Mi for the network binding plugin
1336
+
```
1337
+
1338
+
KubeVirt will create a virt-launcher pod's compute container with a memory request containing the following:
1339
+
- Guest's memory
1340
+
- Memory overhead for KubeVirt's components (calculated by virt-controller)
1341
+
- Memory overhead for the network binding plugin
1342
+
1343
+
Pros:
1344
+
- Already implemented.
1345
+
1346
+
Cons:
1347
+
- Error prune
1348
+
- Defined per VM and not cluster-wide.
1349
+
- Exposes the VM owner to unnecessary implementation details
1350
+
1351
+
2. Mutating webhook
1352
+
1353
+
For each unique network binding plugin used, the VMI controller will add a label on the virt-launcher pod with the following format:
The binding plugin authors will provide a [mutating webhook](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#mutatingadmissionwebhook) that will intercept
1358
+
virt-launcher pod creation that have the above label, and add the appropriate resources requests/limits
1359
+
for the pod's `compute` container.
1360
+
1361
+
The mutating webhook will be able to identify the plugin's compute container by its name (`compute`) or using the value of
1362
+
the `kubectl.kubernetes.io/default-container` annotation.
1363
+
1364
+
Pros:
1365
+
- Plugin authors have full control over the compute resources
1366
+
- Additional API is not added to KubeVirt.
1367
+
- Opens the door for additional changes to the virt-launcher pod without changes to KubeVirt.
1368
+
- Code changes in KubeVirt are very small.
1369
+
1370
+
Cons:
1371
+
- Plugin authors should provide another component and integrate it.
1372
+
- Additional point of failure.
1373
+
- Requires maintaining certificates for the webhook.
1374
+
- Additional latency when creating VMs with network binding plugins.
1375
+
- The additional resource specification is less visible to cluster admins.
1376
+
- Resource specification could collide with the support container resources specified on the KubeVirt CR or other webhooks.
1377
+
1378
+
The requirement to maintain certificates for the webhook could be mitigated using tools such as [cert-manager](https://cert-manager.io/).
0 commit comments