-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
allow switching of port-forward approaches when rootless/using slirp4netns #6324
allow switching of port-forward approaches when rootless/using slirp4netns #6324
Conversation
Hi @aleks-mariusz. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @TomSweeneyRedHat |
/ok-to-test |
LGTM |
1 similar comment
LGTM |
Can the manpages be updated to include the new network modes? |
/approve |
Friendly ping. Once https://github.com/containers/libpod/pull/6324/files/b9893ce95307629cfc54bd8707859c6c2bb146b6#diff-6018b2b043bbcbdd9ac0f143ac9458be is addressed, we can merge. |
@aleks-mariusz Are you still working on this. Simple change and then we merge. |
b9893ce
to
2821297
Compare
Sorry, just re-pushed the commit w/ the change |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AkihiroSuda, aleks-mariusz, 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 |
/retest LGTM |
Tests aren't looking all that hip |
@aleks-mariusz Please fix the tests might need a rebase. |
@aleks-mariusz could you please rebase and push again? |
2821297
to
802433b
Compare
bare with me, trying to fix this now.. rebasing off master did not seem to be the right move (or i didn't do it correctly) |
802433b
to
c6cdbcd
Compare
@giuseppe can we try again please? i messed up the previously attempt (rebased off a stale master), and now have hand re-applied the patch to a new branch based off latest master, and re-pushed now.. |
/retest |
1 similar comment
/retest |
@aleks-mariusz I'd like to get this feature merged. Could we try to rebase again? For rebasing, it should be enough to do:
|
As of podman 1.8.0, because of commit da7595a, the default approach of providing port-forwarding in rootless mode has switched (and been hard-coded) to rootlessport, for the purpose of providing super performance. The side-effect of this switch is source within the container to the port-forwarded service always appears to originate from 127.0.0.1 (see issue containers#5138). This commit allows a user to specify if they want to revert to the previous approach of leveraging slirp4netns add_hostfwd() api which, although not as stellar performance, restores usefulness of seeing incoming traffic origin IP addresses. The change should be transparent; when not specified, rootlessport will continue to be used, however if specifying --net slirp4netns:slirplisten the old approach will be used. Note: the above may imply the restored port-forwarding via slirp4netns is not as performant as the new rootlessport approach, however the figures shared in the original commit that introduced rootlessport are as follows: slirp4netns: 8.3 Gbps, RootlessKit: 27.3 Gbps, which are more than sufficient for many use cases where the origin of traffic is more important than limits that cannot be reached due to bottlenecks elsewhere. Signed-off-by: Aleks Mariusz <[email protected]>
c6cdbcd
to
3c2cbcb
Compare
Commands (adjusted to my setup) and re-ran:
Let me know if there's an issue with the above |
thanks, tests are finally green. LGTM @mheon do you want to wait for the merge? |
@@ -66,7 +66,7 @@ func (c *Container) validate() error { | |||
|
|||
// Rootless has some requirements, compared to networks. | |||
if rootless.IsRootless() { | |||
if len(c.config.Networks) > 0 { | |||
if !c.config.NetMode.IsSlirp4netns() && len(c.config.Networks) > 0 { |
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.
I think CNI networks are still unsupported with Slirp, so this should probably be removed unless I missed something
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.
Unfortunately without this, a any param to --net that contains a : character results in an error about rootless not supporting choosing a network CNI
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.
Hmmm. Let me look a bit, but I suspect this is mostly because of how we're parsing at the command line level.
…RT_DRIVER The default port driver "builtin" might not be always preferrable as it drops src IP information: containers/podman#6324 Now the port driver can be changed to "slirp4netns" via the environment variable `DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER`. It is still recommended to use the default "builtin" driver. Signed-off-by: Akihiro Suda <[email protected]>
…RT_DRIVER The default port driver "builtin" might not be always preferrable as it drops src IP information: containers/podman#6324 Now the port driver can be changed to "slirp4netns" via the environment variable `DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER`. It is still recommended to use the default "builtin" driver. Signed-off-by: Akihiro Suda <[email protected]> Upstream-commit: 6743320a125e6c351aef13a0772dd6e8cea90482 Component: engine
What's current status? |
@aleks-mariusz are you still interested in this feature? |
let's follow up here: #6965 |
This PR is by request against master (the other original PR was against the 1.9 branch as that's what i was asked to base it off of).
As of podman 1.8.0, because of commit da7595a, the default approach of providing port-forwarding in rootless mode has switched (and been hard-coded) to rootlessport, for the purpose of providing super performance. The side-effect of this switch is source within the container to the port-forwarded service always appears to originate from 127.0.0.1 (see issue #5138).
This commit allows a user to specify if they want to revert to the previous approach
of leveraging slirp4netns add_hostfwd() api which, although not as stellar performance,
restores usefulness of seeing incoming traffic origin IP addresses.
The change should be transparent; when not specified, rootlessport will continue to be
used, however if specifying
--net slirp4netns:slirplisten
the old approach will be used.Testing performed in rootless mode of relevant functionality:
Default behaviour scenario 1 (nothing specified, so not taking advantage of this commit original behaviour (higher performance rootlessport in use))
Default behaviour scenario 2 (specifying just --net slirp4netns, which is default when in rootless mode)
Restored (old, pre-1.8.0) behaviour, where source IP show true origin of port-forwarded traffic.
Note: the above may imply the restored port-forwarding via slirp4netns is not as performant as the new rootlessport approach, however the figures shared in the original commit that introduced rootlessport are as follows:
socat: 5.2 Gbps, slirp4netns: 8.3 Gbps, RootlessKit: 27.3 Gbps
, which are more than sufficient for many use cases where the origin of traffic is more important than limits that cannot be reached due to bottlenecks elsewhere.Signed-off-by: Aleks Mariusz <[email protected]>