mirror of
https://github.com/containers/podman.git
synced 2025-06-27 21:50:18 +08:00
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: #1325 Approved by: mheon
This commit is contained in:

committed by
Atomic Bot

parent
f1b4f43d75
commit
af9f83f11c
@ -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())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user