Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve backwards compatibility of CreateNetworkStatus
The CNI spec - [0] - states that the `sandbox` attribute in the CNI result should be used to represent: ``` The isolation domain reference (e.g. path to network namespace) for the interface, or empty if on the host. For interfaces created inside the container, this should be the value passed via CNI_NETNS ``` Some CNIs (like calico) do **not** set the sandbox for their interfaces (below you'll find an example of a cached CNI result created by calico CNI): ``` { ... "result": { "cniVersion": "0.3.1", "dns": {}, "interfaces": [ { "name": "cali05f4a1849c5" } ], "ips": [ { "address": "10.244.196.152/32", "version": "4" }, { "address": "fd10:244::c497/128", "version": "6" } ] } } ``` Thus, when multus started to use `CreateNetworkStatuses` (plural) we broke calico users relying on the network-status annotations (since that function relies on the sandbox attribute being defined to identify container interfaces). This commit changes the code to use the original status creation whenever `CreateNetworkStatuses` is created with a single interface, thus ensuring the original behavior will be provided to user. Unit tests are also added. [0] - https://github.com/containernetworking/cni/blob/main/SPEC.md#add-success Signed-off-by: Miguel Duarte Barroso <[email protected]>
- Loading branch information