[v5.2-rhel] Fix exposed ports#24397
Merged
openshift-merge-bot[bot] merged 4 commits intocontainers:v5.2-rhelfrom Oct 29, 2024
Merged
[v5.2-rhel] Fix exposed ports#24397openshift-merge-bot[bot] merged 4 commits intocontainers:v5.2-rhelfrom
openshift-merge-bot[bot] merged 4 commits intocontainers:v5.2-rhelfrom
Conversation
when net=host Previously, we didn't bother including exposed ports in the container config when creating a container with --net=host. Per Docker this isn't really correct; host-net containers are still considered to have exposed ports, even though that specific container can be guaranteed to never use them. We could just fix this for host container, but we might as well make it generic. This patch unconditionally adds exposed ports to the container config - it was previously conditional on a network namespace being configured. The behavior of `podman inspect` with exposed ports when using `--net=container:` has also been corrected. Previously, we used exposed ports from the container sharing its network namespace, which was not correct. Now, we use regular port bindings from the namespace container, but exposed ports from our own container. Fixes https://issues.redhat.com/browse/RHEL-60382 Signed-off-by: Matt Heon <mheon@redhat.com> (cherry picked from commit a619c03) Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
A field we missed versus Docker. Matches the format of our
existing Ports list in the NetworkConfig, but only includes
exposed ports (and maps these to struct{}, as they never go to
real ports on the host).
Fixes https://issues.redhat.com/browse/RHEL-60382
Signed-off-by: Matt Heon <mheon@redhat.com>
(cherry picked from commit edc3dc5)
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
Undoing some of my own work here from containers#24090 now that we have the ExposedPorts field implemented in inspect. I considered a revert of that patch, but it's still needed as without it we'd be including exposed ports when --net=container which is not correct. Basically, exposed ports for a container should always go in the new ExposedPorts field we added. They sometimes go in the Ports field in NetworkSettings, but only when the container is not net=host and not net=container. We were always including exposed ports, which was not correct, but is an easy logical fix. Also required is a test change to correct the expected behavior as we were testing for incorrect behavior. Fixes https://issues.redhat.com/browse/RHEL-60382 Signed-off-by: Matt Heon <mheon@redhat.com> (cherry picked from commit 8061553) Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
An additional tweak from @Luap99 in containers#24333 regarding the looping in libpod/container_inspect.go. The range over int syntax was only added in go 1.22, this branch is currently build with go 1.21 in RHEL so we need to convert it back to the old syntax. And add the missing "fmt" import in the test file. Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
Member
Author
|
Podman v4.9-rhel PR for reference: #24333 |
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99, TomSweeneyRedHat The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes an exposed ports issue in RHEL 5.2-rhel for RHEL 9.5.
FIxes: https://issues.redhat.com/browse/RHEL-62566
This includes the fixes from the following PRs:
First PR: #24090
Second PR: #24110
Third PR: #24164
With an additional tweak from @Luap99 in 0889c74
regarding the looping in libpod/container_inspect.go.
These changes are needed in the 5.2-rhel branch to ensure a successful
upgrades as the same patches have been used for the following issues
in the Podman v4.9-rhel branch for these issues:
Fixes: https://issues.redhat.com/browse/ACCELFIX-299
Fixes: https://issues.redhat.com/browse/ACCELFIX-300
Does this PR introduce a user-facing change?