summaryrefslogtreecommitdiff
path: root/libpod/kube.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-29 10:32:10 -0400
committerGitHub <noreply@github.com>2021-09-29 10:32:10 -0400
commita22a9a5218774ba809a60a650f10ff300551faa5 (patch)
treea1197be032b54e9ae63ab3771732961349ec4cd5 /libpod/kube.go
parent512a994e8b422f2bdd77c521f7042cd04cfb90db (diff)
parenta3cdee9796497e46531549f906e6695021e48305 (diff)
downloadpodman-a22a9a5218774ba809a60a650f10ff300551faa5.tar.gz
podman-a22a9a5218774ba809a60a650f10ff300551faa5.tar.bz2
podman-a22a9a5218774ba809a60a650f10ff300551faa5.zip
Merge pull request #11761 from umohnani8/init
Add port configuration to first regular container
Diffstat (limited to 'libpod/kube.go')
-rw-r--r--libpod/kube.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/kube.go b/libpod/kube.go
index d17ca1114..69c90c233 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -253,7 +253,9 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
// We add the original port declarations from the libpod infra container
// to the first kubernetes container description because otherwise we loose
// the original container/port bindings.
- if first && len(ports) > 0 {
+ // Add the port configuration to the first regular container or the first
+ // init container if only init containers have been created in the pod.
+ if first && len(ports) > 0 && (!isInit || len(containers) == 2) {
ctr.Ports = ports
first = false
}