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

Quadlet add support for --add-host --ip and --ip6 #23713

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

jerome59
Copy link
Contributor

Fixes: #23692

  • Add support for --add-host for Pod and Container units. It is possible to specify multiple hosts for a single IP.
  • Add support for IP and IP6 for Pod units.

Does this PR introduce a user-facing change?

Podman Quadlet Pod and Containers now supports AddHost
Podman Quadlet Pod now supports  IP and IP6

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 22, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 22, 2024
Copy link
Contributor

@ygalblum ygalblum left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. 2 small comments.
In addition, since you define the structure for the AddHost key and return errors on invalid values, please add negative test cases as well. You can find examples in this table: https://github.com/containers/podman/blob/main/test/e2e/quadlet_test.go#L1018

pkg/systemd/quadlet/quadlet.go Outdated Show resolved Hide resolved
test/e2e/quadlet/host.container Outdated Show resolved Hide resolved
@jerome59 jerome59 requested a review from ygalblum August 22, 2024 15:29
Copy link
Contributor

@ygalblum ygalblum left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 22, 2024
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

I am not sure I like a new different syntax for only quadlet files. IMO the syntax should match podman cli as much as possible.

So if you really think this syntax is needed then it should go into podman proper so there are not random syntax differences for the option values.


// Add hosts to the podman command
// An IP can refer to one or multiple hosts following the format :
// my-host-name;my-second-host-name;third-hostname:192.168.10.10
Copy link
Member

Choose a reason for hiding this comment

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

What is the point of inventing a new syntax? If you want multiple hosts entries specify them several times.
I am not sure why this extra complexity is needed over the simple

addHosts := quadletUnitFile.LookupAll(groupName, KeyAddHost)
for _, addHost := range addHosts {
	podman.add("--add-host=" + addHost)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have an application which needs a lots of entry in the host files and multiple hostname refer to the same IP.

With kube play (or also directly by editing the hosts file), we can set multiple hostname for an IP without duplicating that IP. I think it helps with the clarity of the file.

However, I agree that it would be better if it wasn't a quadlet specific syntax. Beginning of next week I will remove this specificity from the PR.

@jerome59 jerome59 force-pushed the main branch 2 times, most recently from 397c4af to 41877a6 Compare August 26, 2024 10:50
@Luap99
Copy link
Member

Luap99 commented Aug 26, 2024

please squash your fixup commits into the AddHost commit, having two commit for IP and AddHost is great but having extra commits that remove features/fix bug from an earlier commit in the PR should juts be squashed into the original commit adding them.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks, If you like to have the several host for one ip syntax I suggest you file a new issue so we can consider this for the proper podman cli. Then quadlet units could use it without further changes.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 27, 2024
Copy link
Contributor

openshift-ci bot commented Aug 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jerome59, Luap99, ygalblum

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-merge-bot openshift-merge-bot bot merged commit 9892fee into containers:main Aug 27, 2024
85 checks passed
@jerome59
Copy link
Contributor Author

@Luap99 : Thanks for the merge. I've opened the issue regarding the new syntax #23770 so it can be discussed there.

@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Nov 26, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Nov 26, 2024
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. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quadlet add support for --add-host
4 participants