Skip to content

Re-introduce serial network setup#99

Merged
mikebrow merged 1 commit intocontainerd:mainfrom
marc-schwind:serial_network_setup
May 17, 2022
Merged

Re-introduce serial network setup#99
mikebrow merged 1 commit intocontainerd:mainfrom
marc-schwind:serial_network_setup

Conversation

@marc-schwind
Copy link
Copy Markdown
Contributor

@marc-schwind marc-schwind commented May 17, 2022

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 of CNI.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-thing

For 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.

Signed-off-by: Marc Schwind <marc.schwind@de.ibm.com>
Copy link
Copy Markdown
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks!

@dims
Copy link
Copy Markdown
Member

dims commented May 17, 2022

LGTM

@mikebrow mikebrow merged commit 8cb24f1 into containerd:main May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants