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 etchosts package from c/common #3917

Merged
merged 2 commits into from
Apr 21, 2022
Merged

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Apr 19, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

Use the new etchosts package to generate the hosts file.
This will ensure that we use the same logic in podman and buildah.

New features are:

  • no duplicated entries
  • adds entries for the network/slirp4netns ips
  • configure the host.containers.internal entry in containers.conf
  • configure the base hosts file in containers.conf

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?


@TomSweeneyRedHat
Copy link
Member

@Luap99 needs a no new tests tag, or a new test.
Overall, LGTM. I know this matches Podman functionality, but does it match Docker's too?

@Luap99
Copy link
Member Author

Luap99 commented Apr 19, 2022

I don't think we are docker compatible here. Docker does not add the container name, we do this in buildah and podman (currently) and I think this makes more sense. Also docker does not have the duplicate entries detection logic so this can result in problems for users when they manually add them with --add-host and podman/buildah could add another entry with this name.

Overall I think this is much better and more robust compared to docker. I also don't think users would rely on such "undefined" behaviour but we never know until they are complaining to us.

@TomSweeneyRedHat
Copy link
Member

@rhatdan 's call, but I'm very leery to not match Docker's default behavior. If we add a new option that handles this difference with additional options like we did with --pull=never, then I'm fine with that.

@rhatdan
Copy link
Member

rhatdan commented Apr 20, 2022

I am fine with this change, Having the /etc/hosts work the same in builds versus regular containers in podman run and podman build, makes sense to me.

@Luap99
Copy link
Member Author

Luap99 commented Apr 21, 2022

@TomSweeneyRedHat Well we match mostly docker, we just add the container name as well. This is done currently in both podman and buildah and I see no reason to change this. This should also not cause any issues for docker users since it is just an extra name.

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 21, 2022
@Luap99 Luap99 marked this pull request as ready for review April 21, 2022 10:40
Signed-off-by: Paul Holzinger <[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 Apr 21, 2022
@rhatdan
Copy link
Member

rhatdan commented Apr 21, 2022

LGTM
/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 21, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, 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

@rhatdan
Copy link
Member

rhatdan commented Apr 21, 2022

/lgtm
/hold

Use the new etchosts package to generate the hosts file.
This will ensure that we use the same logic in podman and buildah.

New features are:
- no duplicated entries
- adds entries for the network/slirp4netns ips
- configure the host.containers.internal entry in containers.conf
- configure the base hosts file in containers.conf

Signed-off-by: Paul Holzinger <[email protected]>
@Luap99
Copy link
Member Author

Luap99 commented Apr 21, 2022

tests are green

@rhatdan
Copy link
Member

rhatdan commented Apr 21, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Apr 21, 2022
@rhatdan
Copy link
Member

rhatdan commented Apr 21, 2022

/hold cancel

@openshift-merge-robot openshift-merge-robot merged commit d93a4eb into containers:main Apr 21, 2022
@Luap99 Luap99 deleted the hosts branch April 21, 2022 19:08
necrose99 pushed a commit to necrose99/buildah that referenced this pull request Apr 22, 2022
use etchosts package from c/common

Signed-off-by: Mike Lawrenceit.com <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants