diff --git a/.changelog/22312.txt b/.changelog/22312.txt new file mode 100644 index 000000000..b742299c2 --- /dev/null +++ b/.changelog/22312.txt @@ -0,0 +1,3 @@ +```release-note:bug +connect: fix validation with multiple socket paths +``` diff --git a/nomad/job_endpoint_hook_connect.go b/nomad/job_endpoint_hook_connect.go index fd42cb03c..14917b5cd 100644 --- a/nomad/job_endpoint_hook_connect.go +++ b/nomad/job_endpoint_hook_connect.go @@ -569,7 +569,7 @@ func groupConnectValidate(g *structs.TaskGroup) error { } func groupConnectUpstreamsValidate(g *structs.TaskGroup, services []*structs.Service) error { - listeners := make(map[string]string) // address -> service + listeners := make(map[string]string) // address or path-> service var connectBlockCount int var hasTproxy bool @@ -580,7 +580,12 @@ func groupConnectUpstreamsValidate(g *structs.TaskGroup, services []*structs.Ser } if service.Connect.HasSidecar() && service.Connect.SidecarService.Proxy != nil { for _, up := range service.Connect.SidecarService.Proxy.Upstreams { - listener := net.JoinHostPort(up.LocalBindAddress, strconv.Itoa(up.LocalBindPort)) + var listener string + if up.LocalBindSocketPath == "" { + listener = net.JoinHostPort(up.LocalBindAddress, strconv.Itoa(up.LocalBindPort)) + } else { + listener = up.LocalBindSocketPath + } if s, exists := listeners[listener]; exists { return fmt.Errorf( "Consul Connect services %q and %q in group %q using same address for upstreams (%s)",