From 7e1abf28f10159f58dc5915e5091923269928073 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Thu, 14 Mar 2019 18:53:00 +0000 Subject: [PATCH] Short port names for service load balancer If a port name is longer than 15 characters we are unable to create the associated service load balancer containers. Use our own short name of `lb-port-{port}` to avoid naming issues. For rancher/k3s/issues/90 --- pkg/servicelb/controller.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/servicelb/controller.go b/pkg/servicelb/controller.go index 9010570b1351..11e0bbae3187 100644 --- a/pkg/servicelb/controller.go +++ b/pkg/servicelb/controller.go @@ -272,11 +272,8 @@ func (h *handler) newDeployment(svc *core.Service) (*apps.Deployment, error) { }, } - for i, port := range svc.Spec.Ports { - portName := port.Name - if portName == "" { - portName = fmt.Sprintf("port-%d", i) - } + for _, port := range svc.Spec.Ports { + portName := fmt.Sprintf("lb-port-%d", port.Port) container := core.Container{ Name: portName, Image: image,