-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for slirp network for pods #7783
Conversation
|
||
It("podman create pod with slirp network option", func() { | ||
name := "test" | ||
session := podmanTest.Podman([]string{"pod", "create", "--name", name, "--network", "slirp4netns:port_handler=slirp4netns", "-p", "8082:8000"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the network options to podman pod inspect
and alter the test to verify that port_handler
was set using that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be under InfraConfig or another (new?) field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under InfraConfig is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
Darn, failing tests. Time to dive back in. |
9bf8106
to
88dec59
Compare
pkg/specgen/pod_validate.go
Outdated
@@ -72,9 +72,9 @@ func (p *PodSpecGenerator) Validate() error { | |||
return exclusivePodOptions("NoInfra", "NoManageResolvConf") | |||
} | |||
} | |||
if p.NetNS.NSMode != "" && p.NetNS.NSMode != Bridge && p.NetNS.NSMode != Default { | |||
if p.NetNS.NSMode != "" && p.NetNS.NSMode != Bridge && p.NetNS.NSMode != Default && p.NetNS.NSMode != Slirp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit of a nit, I'd flop the last two tests around, just a bit more readable me thinks.
if p.NetNS.NSMode != "" && p.NetNS.NSMode != Bridge && p.NetNS.NSMode != Default && p.NetNS.NSMode != Slirp { | |
if p.NetNS.NSMode != "" && p.NetNS.NSMode != Bridge && p.NetNS.NSMode != Slirp && p.NetNS.NSMode != Default { |
couple of small nits, nice work and otherwise LGTM |
|
||
Examples: | ||
- `--network slirp4netns:outbound_addr=127.0.0.1,allow_host_loopback=true` | ||
- `--networkslirp4netns:cidr=192.168.0.0/24` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are great, but could you work them into a sample command and move them down to the "Examples" section near the bottom of this page please?
flag --network=slirp4netns[options] for root and rootless pods Signed-off-by: Ashley Cui <[email protected]>
@containers/podman-maintainers PTAL |
|
||
$ podman pod create --network slirp4netns:outbound_addr=127.0.0.1,allow_host_loopback=true | ||
|
||
$ podman pod create --network slirp4netns:cidr=192.168.0.0/24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
LGTM |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ashley-cui, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @ashley-cui !
flag --network=slirp4netns[options] for root and rootless pods
Fixes: #6097
Signed-off-by: Ashley Cui [email protected]