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

pasta: use new --map-guest-addr option #2136

Merged
merged 8 commits into from
Sep 6, 2024

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Aug 26, 2024

see commits, I still need to test and integrate this into podman

Copy link
Contributor

openshift-ci bot commented Aug 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99 Luap99 changed the title pasta: maek sur eo fnew --map-guest-addr option pasta: use new --map-guest-addr option Aug 26, 2024
Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

Two nits caught by accident; not a full review.

if err != nil {
exitErr := &exec.ExitError{}
if errors.As(err, &exitErr) {
// special backwards compat check, --map-guest-addr was just added recently so we cannot hard require it yet
Copy link
Member

Choose a reason for hiding this comment

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

"recently" is problematic in comments. Would you consider adding a YMD, with a hint to future maintainers that this code can be removed once pasta version 20240814 has propagated?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

libnetwork/pasta/pasta_linux.go Show resolved Hide resolved
@Luap99 Luap99 force-pushed the pasta-map-guest-addr branch from 3081b0d to e335652 Compare August 29, 2024 09:32
@Luap99 Luap99 marked this pull request as ready for review August 29, 2024 13:11
@Luap99
Copy link
Member Author

Luap99 commented Aug 29, 2024

@mheon PTAL, podman PR: containers/podman#23791

cc @sbrivio-rh @dgibson

@mheon
Copy link
Member

mheon commented Aug 30, 2024

LGTM on my end

Per feedback[1] the 169.254.0.0/24 range is reserved for future use in
RFC 3927. As such we should not use it here as it might break in the
future if the range gets assigned a new meaning. Switch to 169.254.1.1.

[1] containers/podman#23791 (comment)

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
The --map-guest-addr option allows us to sepcify a ip that is remapped
to the actual host ip that was used by pasta. This is done to fix the
problem where connecting to the host ip was not possible as the same ip
was used in the netns.

We now set --map-guest-addr 169.254.1.2 which follows the same idea we
already used for the --dns-forward option. With that podman can use this
ip to set it for host.containers.internal which should the case where
there was no second host ip available, see
containers/podman#19213

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
--map-guest-addr was just added in 20240814, we cannot yet hard require
this option to be present. This means we must deal with the case where
the option is not working. Both a version check or checking --help would
add extra overhead in the good case. To avoid this we try first with the
new option and if this fails check the error message for the right
error. If it didn't know about the new option we remove it and try to
exec pasta again.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
I already switch all user from the old Setup over to Setup2(), so no we
can again reuse the Setup() name. As such alias Setup and Setup for the
same function and then once I migrated all callers in podman and buildah
I will remove Setup2() here.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
When using the rootless netns (bridge mode) so far podman ignored the
proper pasta or slirp4netns dns sever for networks without aardvark-dns.
This is not good. We should try to use them by default, and with the new
MapGuestAddr option we need to use that as well for
host.containers.internal. The problem is that becuase we only know what
options we uses when we started the process later container starts from
a new podman process do not really see these options if we just cache
the result in memory. So in order to make all following podman process
aware we serialize this info struct as json and later processes read it
when needed.

It also means we do not have to lookup the netns ip evey time so I
removed that code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Use %s as %q just quotes/escapes everything which makes it harder to
read and trim of the last newline and spaces as well.

Also update the warnings comment, we still see warnings by default on
our debian VMs in podman CI so this cannot be on the warning level yet.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@Luap99 Luap99 force-pushed the pasta-map-guest-addr branch from e335652 to 6e7b17b Compare September 2, 2024 08:37
@Luap99 Luap99 marked this pull request as ready for review September 2, 2024 08:39
GetHostContainersInternalIP() is no longer called in podman or buildah
as they use GetHostContainersInternalIPExcluding(). I need to add a new
option so chnage the function to accept the parameters as struct so we
do not have to break the API every time we add a new parameter.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
For the pasta network mode we now use --map-guest-addr which means we
have a specific ip that we want to use as host.containers.internal
address. I first thought we could handle it in podman but that doesn't
work as the contianers.conf option must have a higher priority.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@Luap99
Copy link
Member Author

Luap99 commented Sep 3, 2024

@mheon PTAL again as I added some more changes

Passes podman CI containers/podman#23791 so this is good to merge I would say

@Luap99
Copy link
Member Author

Luap99 commented Sep 5, 2024

@mheon @rhatdan PTAL

@mheon
Copy link
Member

mheon commented Sep 5, 2024

LGTM

@mheon
Copy link
Member

mheon commented Sep 6, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Sep 6, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 5298b83 into containers:main Sep 6, 2024
16 checks passed
@Luap99 Luap99 deleted the pasta-map-guest-addr branch September 6, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants