k8snetworkplumbingwg / multus-cni

A CNI meta-plugin for multi-homed pods in Kubernetes
Apache License 2.0
2.27k stars 577 forks source link

Enhance CNI flexibility to read and write deviceInfo by removing the deviceID restriction #1275

Open jiayoukun opened 2 months ago

jiayoukun commented 2 months ago

Based on the Device Information Specification described in the provided links [https://github.com/k8snetworkplumbingwg/device-info-spec/] [https://github.com/k8snetworkplumbingwg/device-info-spec/blob/main/SPEC.md]

The NPWG Implementation Requirements necessitate checking the deviceID for creating the "CNIDeviceInfoFile", which lacks flexibility. My understanding is that CNIs should also have read and write permissions for deviceInfo. However, in the current Multus code, if the deviceID is not configured in the NetworkAttachmentDefinition (NAD), the "CNIDeviceInfoFile" is not created and passed to the CNI. I believe this part of the code has limitations.

In the current code, I added a condition for generating the "CNIDeviceInfoFile". As long as Capabilities["CNIDeviceInfoFile"] is configured as true in the NAD, an empty file is generated. This way, the "CNIDeviceInfoFile" can be passed to the CNI, allowing CNIs without a deviceID to participate in reading and writing deviceInfo. All the deviceInfo will eventually be returned to the kubelet.

Furthermore, I plan to extend the Device Information Specification in the future to include more adaptable fields, enhancing its flexibility and accommodating a wider range of scenarios.

dougbtv commented 2 months ago

Any chance you could join our community call to talk about this some more? The connection information can be found in the maintainer's agenda

Thanks for the contribution, we'd love to chat about it some more

jiayoukun commented 2 months ago

@dougbtv I apologize for my poor spoken English. I'm afraid that attending the meeting might affect everyone's time. Could we discuss the current PR's content here instead?

The functionality modified in this PR is quite effective and flexible for extending CNI development of more deviceInfo. Wasn't the original intention of using deviceInfo to allow NPWG and CNI to share extended device information? However, the current situation is that CNIs without a deviceID are all limited within NPWG and don't have the opportunity to manipulate deviceInfo.

I hope everyone can provide some assistance! Thank you for the reply!