diff options
author | Urvashi Mohnani <umohnani@redhat.com> | 2021-09-27 15:12:47 -0400 |
---|---|---|
committer | Urvashi Mohnani <umohnani@redhat.com> | 2021-09-28 11:13:24 -0400 |
commit | a3cdee9796497e46531549f906e6695021e48305 (patch) | |
tree | 53ce7e88d4d6e838d9ae872f4073afeb53cb2b41 /libpod/kube.go | |
parent | b60cff8cf8fced448c7e78b5b4d72bd7ce949957 (diff) | |
download | podman-a3cdee9796497e46531549f906e6695021e48305.tar.gz podman-a3cdee9796497e46531549f906e6695021e48305.tar.bz2 podman-a3cdee9796497e46531549f906e6695021e48305.zip |
[NO TESTS NEEDED] Add port configuration to first regular container
When generating a kube yaml and there is a port configuration
add the configuration to the first regular container in the pod
and not to the init container.
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Diffstat (limited to 'libpod/kube.go')
-rw-r--r-- | libpod/kube.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/kube.go b/libpod/kube.go index d94108cf2..f6224f07e 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 } |