Enhance CNI flexibility to read and write deviceInfo by removing the deviceID restriction #1275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.