From e62bfc87c2f27c244ff5b31c8689be93140711fe Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Mon, 12 Jul 2021 11:23:56 -0400 Subject: [PATCH] Allow unspecified protocol on exposed port in kube backend Signed-off-by: Michael Irwin The Compose spec doesn't provide a default value, but the code was defaulting to TCP in the service protocol, just not in the name. If no protocol was specified, it would cause an invalid service name (eg, "80-") --- kube/resources/kube.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kube/resources/kube.go b/kube/resources/kube.go index 0149f1fc2..0b2913bdf 100644 --- a/kube/resources/kube.go +++ b/kube/resources/kube.go @@ -92,12 +92,13 @@ func mapToService(project *types.Project, service types.ServiceConfig) *core.Ser if p.Published != 0 { serviceType = core.ServiceTypeLoadBalancer } + protocol := toProtocol(p.Protocol) ports = append(ports, core.ServicePort{ - Name: fmt.Sprintf("%d-%s", p.Published, strings.ToLower(p.Protocol)), + Name: fmt.Sprintf("%d-%s", p.Published, strings.ToLower(string(protocol))), Port: int32(p.Published), TargetPort: intstr.FromInt(int(p.Target)), - Protocol: toProtocol(p.Protocol), + Protocol: protocol, }) } if len(ports) == 0 { // headless service