Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rootless: fix CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns #140

Merged
merged 7 commits into from
Mar 31, 2021

Conversation

AkihiroSuda
Copy link
Member

No description provided.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
…ns port driver

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
…t driver

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda changed the title [WIP, DNM] rootless: fix CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns rootless: fix CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns Mar 30, 2021
@AkihiroSuda AkihiroSuda marked this pull request as ready for review March 30, 2021 10:11
@AkihiroSuda AkihiroSuda requested a review from ktock March 30, 2021 10:11
@AkihiroSuda AkihiroSuda force-pushed the fix-slirp4netns branch 3 times, most recently from f9c792c to 2949e3a Compare March 30, 2021 10:28
…irp4netns

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
.github/workflows/test.yml Outdated Show resolved Hide resolved
// this is fine
} else {
if portDriverDisallowsLoopbackChildIP {
p.HostIP = childIP.String()
Copy link
Member

Choose a reason for hiding this comment

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

Is it OK that childIP == nil enters this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can’t be nil when portDriverDisallowsLoopbackChildIP is true

// For rootless, we need to modify the hostIP that is not bindable in the child namespace.
// https: //github.com/containerd/nerdctl/issues/88
//
// We must NOT modify opts.ports here, because we use the unmodified opts.ports for
// interaction with RootlessKit API.
ports := make([]cni.PortMapping, len(opts.ports))
for i, p := range opts.ports {
if hostIP := net.ParseIP(p.HostIP); hostIP != nil {
if hostIP := net.ParseIP(p.HostIP); hostIP != nil && !hostIP.IsUnspecified() {
// loopback address is always bindable in the child namespace, but other addresses are unlikely.
Copy link
Member

Choose a reason for hiding this comment

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

nit:
not always bindable? (i.e. loopback is not bindable when portDriverDisallowsLoopbackChildIP == true?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Bindable but not forwardable

@AkihiroSuda AkihiroSuda requested a review from ktock March 30, 2021 16:08
@AkihiroSuda AkihiroSuda merged commit db9da4f into containerd:master Mar 31, 2021
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.

2 participants