With the performance improvements introduced with PR76 such use cases break.
This PR re-introduces an additional serialized version SetupSerially(...) of CNI network setup/attach to accommodate the above mentioned use cases, while leaving the main code path untouched to ensure the non-edge cases can benefit from the performance recent enhancement.
Some use cases require serialized network setup to ensure proper network namespace switching on the same thread.
As
ns.Set()
cannot be relied upon when goroutines switch OS threads callers ofCNI.Setup(...)
may want to wrap the setup network creation in a closure locking the OS thread, as described here: https://github.com/containernetworking/plugins/tree/main/pkg/ns#do-the-recommended-thingFor more details and background also see https://github.com/containernetworking/plugins/tree/main/pkg/ns#namespace-switching
With the performance improvements introduced with PR76 such use cases break.
This PR re-introduces an additional serialized version
SetupSerially(...)
of CNI network setup/attach to accommodate the above mentioned use cases, while leaving the main code path untouched to ensure the non-edge cases can benefit from the performance recent enhancement.