multus-cni
multus-cni copied to clipboard
Enhance CNI flexibility to read and write deviceInfo by removing the deviceID restriction
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.