-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix all ports exposed on host by kube play #19823
Conversation
8e7eb12
to
6980823
Compare
Seems like |
I restarted the job 👍 |
6980823
to
56c5878
Compare
var infraPorts []types.PortMapping | ||
for _, container := range containers { | ||
for _, p := range container.Ports { | ||
if p.HostPort != 0 && p.ContainerPort == 0 { | ||
p.ContainerPort = p.HostPort | ||
} | ||
if p.HostPort == 0 && p.ContainerPort != 0 { | ||
if p.HostPort == 0 && p.ContainerPort != 0 && publishAll { | ||
p.HostPort = p.ContainerPort |
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.
Is this correct for K8S? From podman run
/docker run
with --public-all
, I'd expect a random HostPort to be assigned in this case, not setting HostPort to ContainerPort
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.
@umohnani8 @ygalblum PTAL
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 agree that it should have been a random port. But, the question here is backward compatibility.
The new flag breaks the current behavior, and we agreed that it is OK to do so. However, with the proposed change, users can overcome this break by adding this flag. Assigning random ports will break the behavior even further.
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 will need a decisive decision by the maintainers
@vrothberg @rhatdan @mheon @umohnani8 what do we decide here?
I think we should leave the old behavior to allow a simple fix to the backward compatibility break.
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 agree with @ygalblum. The goal of this PR is to stop publishing all ports by default with an easy way to get back to the previous behavior if needed. Picking random ports would break the capability of restoring the previous behavior. 👍
@Backfighter still working on this? |
Yes but I am currently short on time and there are some open topics that I will need a decisive decision by the maintainers on. (See #19823 (comment)) |
e10613d
to
726970a
Compare
Container ports defined with containerPort were exposed by default even though kubernetes interprets them as mostly informative. Closes containers#17028 Signed-off-by: Peter Werner <[email protected]>
726970a
to
f52b02f
Compare
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.
LGTM
Thanks for contributing, @Backfighter ! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Backfighter, vrothberg 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 |
/lgtm |
may I know which podman version will contain this bug fix? |
Definitely podman 4.8 You can request a back port to 4.7 if it is just a bugfix. |
Container ports defined with
containerPort
were exposed by default even though kubernetes interprets them as mostly informative.Closes #17028
User-facing changes