diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-27 22:21:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 22:21:54 +0200 |
commit | dca5ead2d7ad8ac3b14fed6736c102b571d8baf1 (patch) | |
tree | 5d36a6115eb6e17ad8f0531920631b6f9a7a3674 /pkg | |
parent | b794b61817e944ebd22fc74f62f54960877fe6db (diff) | |
parent | f5fc0960e5eddf64a7d8fbf8fbfd3652b4ee5db3 (diff) | |
download | podman-dca5ead2d7ad8ac3b14fed6736c102b571d8baf1.tar.gz podman-dca5ead2d7ad8ac3b14fed6736c102b571d8baf1.tar.bz2 podman-dca5ead2d7ad8ac3b14fed6736c102b571d8baf1.zip |
Merge pull request #15946 from rhatdan/kube
Default missing hostPort to containerPort is defined in kube.yaml
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgen/generate/kube/kube.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index b1828736d..2a0d80cb8 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -914,6 +914,9 @@ func getPodPorts(containers []v1.Container) []types.PortMapping { if p.HostPort != 0 && p.ContainerPort == 0 { p.ContainerPort = p.HostPort } + if p.HostPort == 0 && p.ContainerPort != 0 { + p.HostPort = p.ContainerPort + } if p.Protocol == "" { p.Protocol = "tcp" } |