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

Use hosts public ip address in rootless containers #12375

Merged
merged 1 commit into from
Dec 22, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Nov 20, 2021

Add first non localhost ipv4 of all host interfaces as destination
for host.contaners.internal for rootless containers.

Fixes: #12000

Signed-off-by: Daniel J Walsh [email protected]

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 20, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2021
@rhatdan
Copy link
Member Author

rhatdan commented Nov 20, 2021

@mheon @Luap99 Is this what you intended?

} else {
hosts += fmt.Sprintf("%s host.containers.internal\n", gatewayIP.String())
// getLocalIP returns the non loopback local IP of the host
getLocalIP := func() string {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this a local function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well it was local in Buildah, I will make it Public in Buildah and then we can use it in both places, but this will take a while.

}
return ""
}
if ip := getLocalIP(); ip != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Can you fallback to GetSlirp4netnsGateway() if the ip is empty.

test/system/500-networking.bats Show resolved Hide resolved
@mheon
Copy link
Member

mheon commented Nov 21, 2021

LGTM once comments from @Luap99 are addressed

@rhatdan rhatdan changed the title Use hosts public ip address in rootless containers [WIP] Use hosts public ip address in rootless containers Nov 22, 2021
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 22, 2021
@rhatdan rhatdan changed the title [WIP] Use hosts public ip address in rootless containers Use hosts public ip address in rootless containers Nov 23, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 23, 2021
@rhatdan
Copy link
Member Author

rhatdan commented Nov 24, 2021

@edsantiago I will need you to look at the Buildah bud failures.

@edsantiago
Copy link
Member

The first one: podman build --unsetenv is a NOP (probably need to pass the flag along to buildah).

The second one, hmmm, I'm really confused by. I don't think I'll have time to get deep into it tonight, but basically, there's a buildah test that expects a 128 exit status, and I honestly kind of think that this is a bug in buildah itself: I think this failure should be 125, not 128. I don't know how to fix it for purposes of this PR. Maybe a skip?
https://github.com/containers/buildah/blob/8b79d8b0778fff2db13eb84aacc4d31c22a56872/tests/bud.bats#L778

The third one, no idea, something is expecting manifests to be >1 but it's ==1. I can try to take a closer look later tonight, but more likely tomorrow, sorry.

@edsantiago
Copy link
Member

Is --all-platforms being passed properly to buildah?

@edsantiago
Copy link
Member

Yeah... I think the first and third are that --unsetenv and --all-platforms aren't being passed to buildah. And the second, I really think is a bug in buildah or even git. 128 is just not a normal exit status. It makes no sense.

@rhatdan
Copy link
Member Author

rhatdan commented Nov 24, 2021

Not sure where it comes from, but buildah does exit with a 128.

$ buildah bud git:///tmp/no-such-repository
error prepping temporary context directory: exit status 128
ERRO[0000] exit status 128  

@rhatdan
Copy link
Member Author

rhatdan commented Nov 24, 2021

The exit code comes from git, which buildah is executing.

$ git clone git:///tmp/no-such-repository
Cloning into 'no-such-repository'...
fatal: unable to look up  (port 9418) (Name or service not known)
buildah (group) $ echo $?
128

@edsantiago
Copy link
Member

It comes from git. I believe that's a bug in git, but I don't care about git, I care about buildah. I believe that buildah should exit with one of its standard error exit codes.

@rhatdan
Copy link
Member Author

rhatdan commented Nov 24, 2021

$ buildah build  /tmp/no-such-repository
discovering Containerfile: stat /tmp/no-such-repository: no such file or directory
ERRO[0000] exit status 125   

It should probably be equivalent. But not sure why 128 shouldn't work correctly in a test.

@edsantiago
Copy link
Member

UNIX exit statuses are 0-127. When bit 7 is set, it means there was a signal, e.g., 130 = 128 | 2 = SIGINT. So exit status 128 is what: SIGNOTHING??

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2021
rhatdan added a commit to rhatdan/buildah that referenced this pull request Dec 3, 2021
Currently we are only wiring the logger into run_linux.go
Not into the Config section.

This PR is needed in order to update vendor in Podman.
containers/podman#12375

[NO NEW TESTS NEEDED] Tests will be done in Podman.

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan rhatdan changed the title Use hosts public ip address in rootless containers [WIP] Use hosts public ip address in rootless containers Dec 3, 2021
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 3, 2021
}
if arch == "" {
arch = runtime.GOARCH
}
Copy link
Member

Choose a reason for hiding this comment

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

This overrides values computed from (possibly multiple) Platform values with the single values from arch and os, which looks wrong. They should only be used in place of the values returned by github.com/containerd/containerd/platforms.DefaultSpec() if no Platform values are present, otherwise they should be ignored.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't recall, why I added those, they do not look correct from reading parse. I will remove and see if errors return.

@rhatdan rhatdan force-pushed the hosts branch 2 times, most recently from f2ee714 to 45da1ce Compare December 6, 2021 11:54
@rhatdan rhatdan changed the title [WIP] Use hosts public ip address in rootless containers Use hosts public ip address in rootless containers Dec 6, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 6, 2021
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2021
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 2021
Add first non localhost ipv4 of all host interfaces as destination
for host.contaners.internal for rootless containers.

Fixes: containers#12000

Signed-off-by: Daniel J Walsh <[email protected]>
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 21, 2021
@mheon
Copy link
Member

mheon commented Dec 22, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 22, 2021
@openshift-merge-robot openshift-merge-robot merged commit 2aea0a5 into containers:main Dec 22, 2021
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use hosts public ip address in /etc/hosts for rootless containers
6 participants