From 9168db8bc0b1158389801c2fa53563a4ced3aea5 Mon Sep 17 00:00:00 2001 From: Urvashi Mohnani Date: Thu, 14 Oct 2021 15:03:18 -0400 Subject: Do not add TCP to protocol in generated kube yaml As the default protocol in k8s is TCP, don't add it to the generate yaml when using protocol. Add UDP to the protocol of the generated yaml when udp is being used. Add tests for this as well. Signed-off-by: Urvashi Mohnani --- libpod/kube.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libpod') diff --git a/libpod/kube.go b/libpod/kube.go index 72d2f8e96..ad70dd2cf 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -578,7 +578,8 @@ func ocicniPortMappingToContainerPort(portMappings []ocicni.PortMapping) ([]v1.C var protocol v1.Protocol switch strings.ToUpper(p.Protocol) { case "TCP": - protocol = v1.ProtocolTCP + // do nothing as it is the default protocol in k8s, there is no need to explicitly + // add it to the generated yaml case "UDP": protocol = v1.ProtocolUDP default: -- cgit v1.2.3-54-g00ecf