exposes tcp port only if no proto specified.

Also it fix the issue of exposing both tc/udp port even if
only one proto specified.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>

Closes: 
Approved by: mheon
This commit is contained in:
Kunal Kushwaha
2018-08-23 14:50:38 +09:00
committed by Atomic Bot
parent f1b4f43d75
commit af9f83f11c
2 changed files with 1 additions and 5 deletions

@ -492,10 +492,7 @@ func (c *CreateConfig) CreatePortBindings() ([]ocicni.PortMapping, error) {
} }
pm.HostPort = int32(hostPort) pm.HostPort = int32(hostPort)
// CNI requires us to make both udp and tcp structs pm.Protocol = containerPb.Proto()
pm.Protocol = "udp"
portBindings = append(portBindings, pm)
pm.Protocol = "tcp"
portBindings = append(portBindings, pm) portBindings = append(portBindings, pm)
} }
} }

@ -54,7 +54,6 @@ var _ = Describe("Podman port", func() {
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0)) Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1] port := strings.Split(result.OutputToStringArray()[0], ":")[1]
Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/udp -> 0.0.0.0:%s", port))).To(BeTrue())
Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue()) Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
}) })