Backport of Add CE version of Gateway Upstream Disambiguation into release/1.15.x (#19862)

Add CE version of Gateway Upstream Disambiguation

Co-authored-by: Thomas Eckert <teckert@hashicorp.com>
pull/19789/head
hc-github-team-consul-core 2023-12-08 10:34:13 -06:00 committed by GitHub
parent 48c7d76284
commit 24241e3d69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

3
.changelog/19860.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
connect: Solves an issue where two upstream services with the same name in different namespaces were not getting routed to correctly by API Gateways.
```

View File

@ -229,7 +229,7 @@ func targetForResolverNode(nodeName string, chains []*structs.CompiledDiscoveryC
splitterName := splitterPrefix + strings.TrimPrefix(nodeName, resolverPrefix)
for _, c := range chains {
targetChainPrefix := resolverPrefix + c.ServiceName + "."
targetChainPrefix := resolverPrefix + c.ID()
if strings.HasPrefix(nodeName, targetChainPrefix) && len(c.Nodes) == 1 {
// we have a virtual resolver that just maps to another resolver, return
// the given node name

View File

@ -615,6 +615,7 @@ func TestGatewayChainSynthesizer_Synthesize(t *testing.T) {
chain: &structs.CompiledDiscoveryChain{
ServiceName: "foo",
Namespace: "default",
Partition: "default",
Datacenter: "dc1",
StartNode: "resolver:foo-2.default.default.dc2",
Nodes: map[string]*structs.DiscoveryGraphNode{