[Backport 1.16.x] Add CE version of Gateway Upstream Disambiguation (#19867)
Add CE version of Gateway Upstream Disambiguation Co-authored-by: Thomas Eckert <teckert@hashicorp.com>
This commit is contained in:
parent
b2a57ae0fd
commit
0fafa010bc
|
@ -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.
|
||||||
|
```
|
|
@ -254,7 +254,7 @@ func targetForResolverNode(nodeName string, chains []*structs.CompiledDiscoveryC
|
||||||
splitterName := splitterPrefix + strings.TrimPrefix(nodeName, resolverPrefix)
|
splitterName := splitterPrefix + strings.TrimPrefix(nodeName, resolverPrefix)
|
||||||
|
|
||||||
for _, c := range chains {
|
for _, c := range chains {
|
||||||
targetChainPrefix := resolverPrefix + c.ServiceName + "."
|
targetChainPrefix := resolverPrefix + c.ID()
|
||||||
if strings.HasPrefix(nodeName, targetChainPrefix) && len(c.Nodes) == 1 {
|
if strings.HasPrefix(nodeName, targetChainPrefix) && len(c.Nodes) == 1 {
|
||||||
// we have a virtual resolver that just maps to another resolver, return
|
// we have a virtual resolver that just maps to another resolver, return
|
||||||
// the given node name
|
// the given node name
|
||||||
|
|
|
@ -618,6 +618,7 @@ func TestGatewayChainSynthesizer_Synthesize(t *testing.T) {
|
||||||
chain: &structs.CompiledDiscoveryChain{
|
chain: &structs.CompiledDiscoveryChain{
|
||||||
ServiceName: "foo",
|
ServiceName: "foo",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
|
Partition: "default",
|
||||||
Datacenter: "dc1",
|
Datacenter: "dc1",
|
||||||
StartNode: "resolver:foo-2.default.default.dc2",
|
StartNode: "resolver:foo-2.default.default.dc2",
|
||||||
Nodes: map[string]*structs.DiscoveryGraphNode{
|
Nodes: map[string]*structs.DiscoveryGraphNode{
|
||||||
|
|
Loading…
Reference in New Issue