diff --git a/command/agent/consul/connect_test.go b/command/agent/consul/connect_test.go index e9e63ad4aca50d0a99aabaeac299dcbcdf0cdfa5..27fd09d8160bca1e234d34bbf854a57e0efeffba 100644 --- a/command/agent/consul/connect_test.go +++ b/command/agent/consul/connect_test.go @@ -22,10 +22,10 @@ var ( }, }} testConnectPorts = structs.AllocatedPorts{{ - Label = "connect-proxy-redis" - Value = 3000, - To = 3000, - HostIP = "192.168.30.1", + Label: "connect-proxy-redis", + Value: 3000, + To: 3000, + HostIP: "192.168.30.1", }} ) diff --git a/nomad/job_endpoint_hook_connect.go b/nomad/job_endpoint_hook_connect.go index 20601a433b79e5406de3516388d531d334d1d3ae..1e215f6196aad778fa937b99eb42c1b8e6a3977a 100644 --- a/nomad/job_endpoint_hook_connect.go +++ b/nomad/job_endpoint_hook_connect.go @@ -249,7 +249,7 @@ func groupConnectHook(job *structs.Job, g *structs.TaskGroup) error { // create a port for the sidecar task's proxy port portLabel := service.Connect.SidecarService.Port - if portLabel != "" { + if portLabel == "" { portLabel = fmt.Sprintf("%s-%s", structs.ConnectProxyPrefix, service.Name) } injectPort(g, portLabel)