partition dicovery chains (#10983)

* partition dicovery chains

* fix default partition for OSS
pull/10566/head
Dhia Ayachi 2021-09-07 16:29:32 -04:00 committed by GitHub
parent 74e3bf4e68
commit bc0e4f2f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 823 additions and 658 deletions

View File

@ -2,6 +2,8 @@
package acl package acl
const DefaultPartitionName = ""
type EnterpriseConfig struct { type EnterpriseConfig struct {
// no fields in OSS // no fields in OSS
} }

View File

@ -1076,6 +1076,11 @@ func (s *HTTPHandlers) AgentRegisterService(resp http.ResponseWriter, req *http.
Reason: fmt.Sprintf("Invalid SidecarService: %s", err)} Reason: fmt.Sprintf("Invalid SidecarService: %s", err)}
} }
if sidecar != nil { if sidecar != nil {
if err := sidecar.Validate(); err != nil {
resp.WriteHeader(http.StatusBadRequest)
fmt.Fprint(resp, err.Error())
return nil, nil
}
// Make sure we are allowed to register the sidecar using the token // Make sure we are allowed to register the sidecar using the token
// specified (might be specific to sidecar or the same one as the overall // specified (might be specific to sidecar or the same one as the overall
// request). // request).

View File

@ -16,7 +16,7 @@ func TestCompiledDiscoveryChain(t *testing.T) {
typ := &CompiledDiscoveryChain{RPC: rpc} typ := &CompiledDiscoveryChain{RPC: rpc}
// just do the default chain // just do the default chain
chain := discoverychain.TestCompileConfigEntries(t, "web", "default", "dc1", "trustdomain.consul", "dc1", nil) chain := discoverychain.TestCompileConfigEntries(t, "web", "default", "default", "dc1", "trustdomain.consul", "dc1", nil)
// Expect the proper RPC call. This also sets the expected value // Expect the proper RPC call. This also sets the expected value
// since that is return-by-pointer in the arguments. // since that is return-by-pointer in the arguments.

View File

@ -142,17 +142,20 @@ func TestQuerySNI(t *testing.T) {
func TestTargetSNI(t *testing.T) { func TestTargetSNI(t *testing.T) {
// empty namespace, empty subset // empty namespace, empty subset
require.Equal(t, "api.default.foo."+testTrustDomainSuffix1, require.Equal(t, "api.default.foo."+testTrustDomainSuffix1,
TargetSNI(structs.NewDiscoveryTarget("api", "", "", "foo"), testTrustDomain1)) TargetSNI(structs.NewDiscoveryTarget("api", "", "", "default", "foo"), testTrustDomain1))
require.Equal(t, "api.default.foo."+testTrustDomainSuffix1,
TargetSNI(structs.NewDiscoveryTarget("api", "", "", "", "foo"), testTrustDomain1))
// set namespace, empty subset // set namespace, empty subset
require.Equal(t, "api.neighbor.foo."+testTrustDomainSuffix2, require.Equal(t, "api.neighbor.foo."+testTrustDomainSuffix2,
TargetSNI(structs.NewDiscoveryTarget("api", "", "neighbor", "foo"), testTrustDomain2)) TargetSNI(structs.NewDiscoveryTarget("api", "", "neighbor", "default", "foo"), testTrustDomain2))
// empty namespace, set subset // empty namespace, set subset
require.Equal(t, "v2.api.default.foo."+testTrustDomainSuffix1, require.Equal(t, "v2.api.default.foo."+testTrustDomainSuffix1,
TargetSNI(structs.NewDiscoveryTarget("api", "v2", "", "foo"), testTrustDomain1)) TargetSNI(structs.NewDiscoveryTarget("api", "v2", "", "default", "foo"), testTrustDomain1))
// set namespace, set subset // set namespace, set subset
require.Equal(t, "canary.api.neighbor.foo."+testTrustDomainSuffix2, require.Equal(t, "canary.api.neighbor.foo."+testTrustDomainSuffix2,
TargetSNI(structs.NewDiscoveryTarget("api", "canary", "neighbor", "foo"), testTrustDomain2)) TargetSNI(structs.NewDiscoveryTarget("api", "canary", "neighbor", "default", "foo"), testTrustDomain2))
} }

View File

@ -54,8 +54,8 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
return &resp, nil return &resp, nil
} }
newTarget := func(service, serviceSubset, namespace, datacenter string) *structs.DiscoveryTarget { newTarget := func(service, serviceSubset, namespace, partition, datacenter string) *structs.DiscoveryTarget {
t := structs.NewDiscoveryTarget(service, serviceSubset, namespace, datacenter) t := structs.NewDiscoveryTarget(service, serviceSubset, namespace, partition, datacenter)
t.SNI = connect.TargetSNI(t, connect.TestClusterID+".consul") t.SNI = connect.TargetSNI(t, connect.TestClusterID+".consul")
t.Name = t.SNI t.Name = t.SNI
return t return t
@ -68,6 +68,7 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
Name: "web", Name: "web",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
}) })
if !acl.IsErrPermissionDenied(err) { if !acl.IsErrPermissionDenied(err) {
@ -80,6 +81,7 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
Name: "web", Name: "web",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
QueryOptions: structs.QueryOptions{Token: denyToken.SecretID}, QueryOptions: structs.QueryOptions{Token: denyToken.SecretID},
}) })
@ -92,51 +94,81 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
Chain: &structs.CompiledDiscoveryChain{ Chain: &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: true,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc1": newTarget("web", "", "default", "dc1"), "web.default.default.dc1": newTarget("web", "", "default", "default", "dc1"),
}, },
}, },
} }
// various ways with good token // various ways with good token
for _, tc := range []struct { for _, tc := range []struct {
evalDC string evalDC string
evalNS string evalNS string
expect *structs.DiscoveryChainResponse evalPart string
expect *structs.DiscoveryChainResponse
}{ }{
{ {
evalDC: "dc1", evalDC: "dc1",
evalNS: "default", evalNS: "default",
expect: expectDefaultResponse_DC1_Default, evalPart: "default",
expect: expectDefaultResponse_DC1_Default,
}, },
{ {
evalDC: "", evalDC: "",
evalNS: "default", evalNS: "default",
expect: expectDefaultResponse_DC1_Default, evalPart: "default",
expect: expectDefaultResponse_DC1_Default,
}, },
{ {
evalDC: "dc1", evalDC: "dc1",
evalNS: "", evalNS: "",
expect: expectDefaultResponse_DC1_Default, evalPart: "default",
expect: expectDefaultResponse_DC1_Default,
}, },
{ {
evalDC: "", evalDC: "",
evalNS: "", evalNS: "",
expect: expectDefaultResponse_DC1_Default, evalPart: "default",
expect: expectDefaultResponse_DC1_Default,
},
{
evalDC: "dc1",
evalNS: "default",
evalPart: "",
expect: expectDefaultResponse_DC1_Default,
},
{
evalDC: "",
evalNS: "default",
evalPart: "",
expect: expectDefaultResponse_DC1_Default,
},
{
evalDC: "dc1",
evalNS: "",
evalPart: "",
expect: expectDefaultResponse_DC1_Default,
},
{
evalDC: "",
evalNS: "",
evalPart: "",
expect: expectDefaultResponse_DC1_Default,
}, },
} { } {
tc := tc tc := tc
@ -146,6 +178,7 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
Name: "web", Name: "web",
EvaluateInDatacenter: tc.evalDC, EvaluateInDatacenter: tc.evalDC,
EvaluateInNamespace: tc.evalNS, EvaluateInNamespace: tc.evalNS,
EvaluateInPartition: tc.evalPart,
Datacenter: "dc1", Datacenter: "dc1",
QueryOptions: structs.QueryOptions{Token: allowToken.SecretID}, QueryOptions: structs.QueryOptions{Token: allowToken.SecretID},
}) })
@ -177,6 +210,7 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
Name: "web", Name: "web",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
QueryOptions: structs.QueryOptions{Token: allowToken.SecretID}, QueryOptions: structs.QueryOptions{Token: allowToken.SecretID},
}) })
@ -186,21 +220,22 @@ func TestDiscoveryChainEndpoint_Get(t *testing.T) {
Chain: &structs.CompiledDiscoveryChain{ Chain: &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
ConnectTimeout: 33 * time.Second, ConnectTimeout: 33 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc1": newTarget("web", "", "default", "dc1"), "web.default.default.dc1": newTarget("web", "", "default", "default", "dc1"),
}, },
}, },
} }

View File

@ -59,6 +59,7 @@ func Compile(req CompileRequest) (*structs.CompiledDiscoveryChain, error) {
var ( var (
serviceName = req.ServiceName serviceName = req.ServiceName
evaluateInNamespace = req.EvaluateInNamespace evaluateInNamespace = req.EvaluateInNamespace
evaluateInPartition = req.EvaluateInPartition
evaluateInDatacenter = req.EvaluateInDatacenter evaluateInDatacenter = req.EvaluateInDatacenter
evaluateInTrustDomain = req.EvaluateInTrustDomain evaluateInTrustDomain = req.EvaluateInTrustDomain
useInDatacenter = req.UseInDatacenter useInDatacenter = req.UseInDatacenter
@ -70,6 +71,9 @@ func Compile(req CompileRequest) (*structs.CompiledDiscoveryChain, error) {
if evaluateInNamespace == "" { if evaluateInNamespace == "" {
return nil, fmt.Errorf("evaluateInNamespace is required") return nil, fmt.Errorf("evaluateInNamespace is required")
} }
if evaluateInPartition == "" {
return nil, fmt.Errorf("evaluateInPartition is required")
}
if evaluateInDatacenter == "" { if evaluateInDatacenter == "" {
return nil, fmt.Errorf("evaluateInDatacenter is required") return nil, fmt.Errorf("evaluateInDatacenter is required")
} }
@ -85,6 +89,7 @@ func Compile(req CompileRequest) (*structs.CompiledDiscoveryChain, error) {
c := &compiler{ c := &compiler{
serviceName: serviceName, serviceName: serviceName,
evaluateInPartition: evaluateInPartition,
evaluateInNamespace: evaluateInNamespace, evaluateInNamespace: evaluateInNamespace,
evaluateInDatacenter: evaluateInDatacenter, evaluateInDatacenter: evaluateInDatacenter,
evaluateInTrustDomain: evaluateInTrustDomain, evaluateInTrustDomain: evaluateInTrustDomain,
@ -122,6 +127,7 @@ func Compile(req CompileRequest) (*structs.CompiledDiscoveryChain, error) {
type compiler struct { type compiler struct {
serviceName string serviceName string
evaluateInNamespace string evaluateInNamespace string
evaluateInPartition string
evaluateInDatacenter string evaluateInDatacenter string
evaluateInTrustDomain string evaluateInTrustDomain string
useInDatacenter string useInDatacenter string
@ -323,6 +329,7 @@ func (c *compiler) compile() (*structs.CompiledDiscoveryChain, error) {
return &structs.CompiledDiscoveryChain{ return &structs.CompiledDiscoveryChain{
ServiceName: c.serviceName, ServiceName: c.serviceName,
Namespace: c.evaluateInNamespace, Namespace: c.evaluateInNamespace,
Partition: c.evaluateInPartition,
Datacenter: c.evaluateInDatacenter, Datacenter: c.evaluateInDatacenter,
CustomizationHash: customizationHash, CustomizationHash: customizationHash,
Protocol: c.protocol, Protocol: c.protocol,
@ -522,7 +529,7 @@ func (c *compiler) assembleChain() error {
if router == nil { if router == nil {
// If no router is configured, move on down the line to the next hop of // If no router is configured, move on down the line to the next hop of
// the chain. // the chain.
node, err := c.getSplitterOrResolverNode(c.newTarget(c.serviceName, "", "", "")) node, err := c.getSplitterOrResolverNode(c.newTarget(c.serviceName, "", "", "", ""))
if err != nil { if err != nil {
return err return err
} }
@ -562,6 +569,7 @@ func (c *compiler) assembleChain() error {
} }
svc := defaultIfEmpty(dest.Service, c.serviceName) svc := defaultIfEmpty(dest.Service, c.serviceName)
destNamespace := defaultIfEmpty(dest.Namespace, router.NamespaceOrDefault()) destNamespace := defaultIfEmpty(dest.Namespace, router.NamespaceOrDefault())
destPartition := router.PartitionOrDefault()
// Check to see if the destination is eligible for splitting. // Check to see if the destination is eligible for splitting.
var ( var (
@ -570,11 +578,11 @@ func (c *compiler) assembleChain() error {
) )
if dest.ServiceSubset == "" { if dest.ServiceSubset == "" {
node, err = c.getSplitterOrResolverNode( node, err = c.getSplitterOrResolverNode(
c.newTarget(svc, "", destNamespace, ""), c.newTarget(svc, "", destNamespace, destPartition, ""),
) )
} else { } else {
node, err = c.getResolverNode( node, err = c.getResolverNode(
c.newTarget(svc, dest.ServiceSubset, destNamespace, ""), c.newTarget(svc, dest.ServiceSubset, destNamespace, destPartition, ""),
false, false,
) )
} }
@ -586,7 +594,7 @@ func (c *compiler) assembleChain() error {
// If we have a router, we'll add a catch-all route at the end to send // If we have a router, we'll add a catch-all route at the end to send
// unmatched traffic to the next hop in the chain. // unmatched traffic to the next hop in the chain.
defaultDestinationNode, err := c.getSplitterOrResolverNode(c.newTarget(router.Name, "", router.NamespaceOrDefault(), "")) defaultDestinationNode, err := c.getSplitterOrResolverNode(c.newTarget(router.Name, "", router.NamespaceOrDefault(), router.PartitionOrDefault(), ""))
if err != nil { if err != nil {
return err return err
} }
@ -617,7 +625,7 @@ func newDefaultServiceRoute(serviceName string, namespace string) *structs.Servi
} }
} }
func (c *compiler) newTarget(service, serviceSubset, namespace, datacenter string) *structs.DiscoveryTarget { func (c *compiler) newTarget(service, serviceSubset, namespace, partition, datacenter string) *structs.DiscoveryTarget {
if service == "" { if service == "" {
panic("newTarget called with empty service which makes no sense") panic("newTarget called with empty service which makes no sense")
} }
@ -626,6 +634,7 @@ func (c *compiler) newTarget(service, serviceSubset, namespace, datacenter strin
service, service,
serviceSubset, serviceSubset,
defaultIfEmpty(namespace, c.evaluateInNamespace), defaultIfEmpty(namespace, c.evaluateInNamespace),
defaultIfEmpty(partition, c.evaluateInPartition),
defaultIfEmpty(datacenter, c.evaluateInDatacenter), defaultIfEmpty(datacenter, c.evaluateInDatacenter),
) )
@ -645,10 +654,11 @@ func (c *compiler) newTarget(service, serviceSubset, namespace, datacenter strin
return t return t
} }
func (c *compiler) rewriteTarget(t *structs.DiscoveryTarget, service, serviceSubset, namespace, datacenter string) *structs.DiscoveryTarget { func (c *compiler) rewriteTarget(t *structs.DiscoveryTarget, service, serviceSubset, partition, namespace, datacenter string) *structs.DiscoveryTarget {
var ( var (
service2 = t.Service service2 = t.Service
serviceSubset2 = t.ServiceSubset serviceSubset2 = t.ServiceSubset
partition2 = t.Partition
namespace2 = t.Namespace namespace2 = t.Namespace
datacenter2 = t.Datacenter datacenter2 = t.Datacenter
) )
@ -661,6 +671,9 @@ func (c *compiler) rewriteTarget(t *structs.DiscoveryTarget, service, serviceSub
if serviceSubset != "" { if serviceSubset != "" {
serviceSubset2 = serviceSubset serviceSubset2 = serviceSubset
} }
if partition != "" {
partition2 = partition
}
if namespace != "" { if namespace != "" {
namespace2 = namespace namespace2 = namespace
} }
@ -668,7 +681,7 @@ func (c *compiler) rewriteTarget(t *structs.DiscoveryTarget, service, serviceSub
datacenter2 = datacenter datacenter2 = datacenter
} }
return c.newTarget(service2, serviceSubset2, namespace2, datacenter2) return c.newTarget(service2, serviceSubset2, namespace2, partition2, datacenter2)
} }
func (c *compiler) getSplitterOrResolverNode(target *structs.DiscoveryTarget) (*structs.DiscoveryGraphNode, error) { func (c *compiler) getSplitterOrResolverNode(target *structs.DiscoveryTarget) (*structs.DiscoveryGraphNode, error) {
@ -735,7 +748,7 @@ func (c *compiler) getSplitterNode(sid structs.ServiceID) (*structs.DiscoveryGra
} }
node, err := c.getResolverNode( node, err := c.getResolverNode(
c.newTarget(splitID.ID, split.ServiceSubset, splitID.NamespaceOrDefault(), ""), c.newTarget(splitID.ID, split.ServiceSubset, splitID.NamespaceOrDefault(), splitID.PartitionOrDefault(), ""),
false, false,
) )
if err != nil { if err != nil {
@ -806,6 +819,7 @@ RESOLVE_AGAIN:
// Handle redirects right up front. // Handle redirects right up front.
// //
// TODO(rb): What about a redirected subset reference? (web/v2, but web redirects to alt/"") // TODO(rb): What about a redirected subset reference? (web/v2, but web redirects to alt/"")
if resolver.Redirect != nil { if resolver.Redirect != nil {
redirect := resolver.Redirect redirect := resolver.Redirect
@ -813,6 +827,7 @@ RESOLVE_AGAIN:
target, target,
redirect.Service, redirect.Service,
redirect.ServiceSubset, redirect.ServiceSubset,
target.Partition,
redirect.Namespace, redirect.Namespace,
redirect.Datacenter, redirect.Datacenter,
) )
@ -830,6 +845,7 @@ RESOLVE_AGAIN:
resolver.DefaultSubset, resolver.DefaultSubset,
"", "",
"", "",
"",
) )
goto RESOLVE_AGAIN goto RESOLVE_AGAIN
} }
@ -962,6 +978,7 @@ RESOLVE_AGAIN:
target, target,
failover.Service, failover.Service,
failover.ServiceSubset, failover.ServiceSubset,
target.Partition,
failover.Namespace, failover.Namespace,
dc, dc,
) )
@ -975,6 +992,7 @@ RESOLVE_AGAIN:
target, target,
failover.Service, failover.Service,
failover.ServiceSubset, failover.ServiceSubset,
target.Partition,
failover.Namespace, failover.Namespace,
"", "",
) )

File diff suppressed because it is too large Load Diff

View File

@ -6,16 +6,14 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestCompileConfigEntries( func TestCompileConfigEntries(t testing.T,
t testing.T,
serviceName string, serviceName string,
evaluateInNamespace string, evaluateInNamespace string,
evaluateInPartition string,
evaluateInDatacenter string, evaluateInDatacenter string,
evaluateInTrustDomain string, evaluateInTrustDomain string,
useInDatacenter string, useInDatacenter string,
setup func(req *CompileRequest), setup func(req *CompileRequest), entries ...structs.ConfigEntry) *structs.CompiledDiscoveryChain {
entries ...structs.ConfigEntry,
) *structs.CompiledDiscoveryChain {
set := structs.NewDiscoveryChainConfigEntries() set := structs.NewDiscoveryChainConfigEntries()
set.AddEntries(entries...) set.AddEntries(entries...)
@ -23,6 +21,7 @@ func TestCompileConfigEntries(
req := CompileRequest{ req := CompileRequest{
ServiceName: serviceName, ServiceName: serviceName,
EvaluateInNamespace: evaluateInNamespace, EvaluateInNamespace: evaluateInNamespace,
EvaluateInPartition: evaluateInPartition,
EvaluateInDatacenter: evaluateInDatacenter, EvaluateInDatacenter: evaluateInDatacenter,
EvaluateInTrustDomain: evaluateInTrustDomain, EvaluateInTrustDomain: evaluateInTrustDomain,
UseInDatacenter: useInDatacenter, UseInDatacenter: useInDatacenter,

View File

@ -391,6 +391,7 @@ func (s *Store) discoveryChainTargetsTxn(tx ReadTxn, ws memdb.WatchSet, dc, serv
req := discoverychain.CompileRequest{ req := discoverychain.CompileRequest{
ServiceName: source.Name, ServiceName: source.Name,
EvaluateInNamespace: source.NamespaceOrDefault(), EvaluateInNamespace: source.NamespaceOrDefault(),
EvaluateInPartition: source.PartitionOrDefault(),
EvaluateInDatacenter: dc, EvaluateInDatacenter: dc,
UseInDatacenter: dc, UseInDatacenter: dc,
} }
@ -448,6 +449,7 @@ func (s *Store) discoveryChainSourcesTxn(tx ReadTxn, ws memdb.WatchSet, dc strin
req := discoverychain.CompileRequest{ req := discoverychain.CompileRequest{
ServiceName: sn.Name, ServiceName: sn.Name,
EvaluateInNamespace: sn.NamespaceOrDefault(), EvaluateInNamespace: sn.NamespaceOrDefault(),
EvaluateInPartition: sn.PartitionOrDefault(),
EvaluateInDatacenter: dc, EvaluateInDatacenter: dc,
UseInDatacenter: dc, UseInDatacenter: dc,
} }
@ -717,6 +719,7 @@ func testCompileDiscoveryChain(
req := discoverychain.CompileRequest{ req := discoverychain.CompileRequest{
ServiceName: chainName, ServiceName: chainName,
EvaluateInNamespace: entMeta.NamespaceOrDefault(), EvaluateInNamespace: entMeta.NamespaceOrDefault(),
EvaluateInPartition: entMeta.PartitionOrDefault(),
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInTrustDomain: "b6fc9da3-03d4-4b5a-9134-c045e9b20152.consul", EvaluateInTrustDomain: "b6fc9da3-03d4-4b5a-9134-c045e9b20152.consul",
UseInDatacenter: "dc1", UseInDatacenter: "dc1",
@ -1200,6 +1203,7 @@ func protocolForService(
req := discoverychain.CompileRequest{ req := discoverychain.CompileRequest{
ServiceName: svc.Name, ServiceName: svc.Name,
EvaluateInNamespace: svc.NamespaceOrDefault(), EvaluateInNamespace: svc.NamespaceOrDefault(),
EvaluateInPartition: svc.PartitionOrDefault(),
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
// Use a dummy trust domain since that won't affect the protocol here. // Use a dummy trust domain since that won't affect the protocol here.
EvaluateInTrustDomain: "b6fc9da3-03d4-4b5a-9134-c045e9b20152.consul", EvaluateInTrustDomain: "b6fc9da3-03d4-4b5a-9134-c045e9b20152.consul",

View File

@ -26,8 +26,8 @@ func TestDiscoveryChainRead(t *testing.T) {
defer a.Shutdown() defer a.Shutdown()
testrpc.WaitForTestAgent(t, a.RPC, "dc1") testrpc.WaitForTestAgent(t, a.RPC, "dc1")
newTarget := func(service, serviceSubset, namespace, datacenter string) *structs.DiscoveryTarget { newTarget := func(service, serviceSubset, namespace, partition, datacenter string) *structs.DiscoveryTarget {
t := structs.NewDiscoveryTarget(service, serviceSubset, namespace, datacenter) t := structs.NewDiscoveryTarget(service, serviceSubset, namespace, partition, datacenter)
t.SNI = connect.TargetSNI(t, connect.TestClusterID+".consul") t.SNI = connect.TargetSNI(t, connect.TestClusterID+".consul")
t.Name = t.SNI t.Name = t.SNI
return t return t
@ -76,22 +76,23 @@ func TestDiscoveryChainRead(t *testing.T) {
expect := &structs.CompiledDiscoveryChain{ expect := &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: true,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc1": newTarget("web", "", "default", "dc1"), "web.default.default.dc1": newTarget("web", "", "default", "default", "dc1"),
}, },
} }
require.Equal(t, expect, value.Chain) require.Equal(t, expect, value.Chain)
@ -119,22 +120,23 @@ func TestDiscoveryChainRead(t *testing.T) {
expect := &structs.CompiledDiscoveryChain{ expect := &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc2", Datacenter: "dc2",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc2", StartNode: "resolver:web.default.default.dc2",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc2": { "resolver:web.default.default.dc2": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc2", Name: "web.default.default.dc2",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: true,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "web.default.dc2", Target: "web.default.default.dc2",
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc2": newTarget("web", "", "default", "dc2"), "web.default.default.dc2": newTarget("web", "", "default", "default", "dc2"),
}, },
} }
require.Equal(t, expect, value.Chain) require.Equal(t, expect, value.Chain)
@ -171,22 +173,23 @@ func TestDiscoveryChainRead(t *testing.T) {
expect := &structs.CompiledDiscoveryChain{ expect := &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: true,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc1": newTarget("web", "", "default", "dc1"), "web.default.default.dc1": newTarget("web", "", "default", "default", "dc1"),
}, },
} }
require.Equal(t, expect, value.Chain) require.Equal(t, expect, value.Chain)
@ -233,25 +236,26 @@ func TestDiscoveryChainRead(t *testing.T) {
expect := &structs.CompiledDiscoveryChain{ expect := &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
ConnectTimeout: 33 * time.Second, ConnectTimeout: 33 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
Failover: &structs.DiscoveryFailover{ Failover: &structs.DiscoveryFailover{
Targets: []string{"web.default.dc2"}, Targets: []string{"web.default.default.dc2"},
}, },
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc1": newTarget("web", "", "default", "dc1"), "web.default.default.dc1": newTarget("web", "", "default", "default", "dc1"),
"web.default.dc2": newTarget("web", "", "default", "dc2"), "web.default.default.dc2": newTarget("web", "", "default", "default", "dc2"),
}, },
} }
if !reflect.DeepEqual(expect, value.Chain) { if !reflect.DeepEqual(expect, value.Chain) {
@ -260,7 +264,7 @@ func TestDiscoveryChainRead(t *testing.T) {
}) })
})) }))
expectTarget_DC2 := newTarget("web", "", "default", "dc2") expectTarget_DC2 := newTarget("web", "", "default", "default", "dc2")
expectTarget_DC2.MeshGateway = structs.MeshGatewayConfig{ expectTarget_DC2.MeshGateway = structs.MeshGatewayConfig{
Mode: structs.MeshGatewayModeLocal, Mode: structs.MeshGatewayModeLocal,
} }
@ -268,26 +272,27 @@ func TestDiscoveryChainRead(t *testing.T) {
expectModifiedWithOverrides := &structs.CompiledDiscoveryChain{ expectModifiedWithOverrides := &structs.CompiledDiscoveryChain{
ServiceName: "web", ServiceName: "web",
Namespace: "default", Namespace: "default",
Partition: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "grpc", Protocol: "grpc",
CustomizationHash: "98809527", CustomizationHash: "98809527",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*structs.DiscoveryGraphNode{ Nodes: map[string]*structs.DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
ConnectTimeout: 22 * time.Second, ConnectTimeout: 22 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
Failover: &structs.DiscoveryFailover{ Failover: &structs.DiscoveryFailover{
Targets: []string{"web.default.dc2"}, Targets: []string{"web.default.default.dc2"},
}, },
}, },
}, },
}, },
Targets: map[string]*structs.DiscoveryTarget{ Targets: map[string]*structs.DiscoveryTarget{
"web.default.dc1": newTarget("web", "", "default", "dc1"), "web.default.default.dc1": newTarget("web", "", "default", "default", "dc1"),
expectTarget_DC2.ID: expectTarget_DC2, expectTarget_DC2.ID: expectTarget_DC2,
}, },
} }

View File

@ -135,6 +135,11 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e
ns = u.DestinationNamespace ns = u.DestinationNamespace
} }
partition := s.proxyID.PartitionOrDefault()
if u.DestinationPartition != "" {
partition = u.DestinationPartition
}
cfg, err := parseReducedUpstreamConfig(u.Config) cfg, err := parseReducedUpstreamConfig(u.Config)
if err != nil { if err != nil {
// Don't hard fail on a config typo, just warn. We'll fall back on // Don't hard fail on a config typo, just warn. We'll fall back on
@ -162,14 +167,14 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e
case structs.UpstreamDestTypeService: case structs.UpstreamDestTypeService:
fallthrough fallthrough
// TODO (partition): pass Partition to DiscoveryChainRequest? case "":
case "": // Treat unset as the default Service type
err = s.cache.Notify(ctx, cachetype.CompiledDiscoveryChainName, &structs.DiscoveryChainRequest{ err = s.cache.Notify(ctx, cachetype.CompiledDiscoveryChainName, &structs.DiscoveryChainRequest{
Datacenter: s.source.Datacenter, Datacenter: s.source.Datacenter,
QueryOptions: structs.QueryOptions{Token: s.token}, QueryOptions: structs.QueryOptions{Token: s.token},
Name: u.DestinationName, Name: u.DestinationName,
EvaluateInDatacenter: dc, EvaluateInDatacenter: dc,
EvaluateInNamespace: ns, EvaluateInNamespace: ns,
EvaluateInPartition: partition,
OverrideMeshGateway: s.proxyCfg.MeshGateway.OverlayWith(u.MeshGateway), OverrideMeshGateway: s.proxyCfg.MeshGateway.OverlayWith(u.MeshGateway),
OverrideProtocol: cfg.Protocol, OverrideProtocol: cfg.Protocol,
OverrideConnectTimeout: cfg.ConnectTimeout(), OverrideConnectTimeout: cfg.ConnectTimeout(),

View File

@ -59,53 +59,45 @@ func TestManager_BasicLifecycle(t *testing.T) {
roots, leaf := TestCerts(t) roots, leaf := TestCerts(t)
dbDefaultChain := func() *structs.CompiledDiscoveryChain { dbDefaultChain := func() *structs.CompiledDiscoveryChain {
return discoverychain.TestCompileConfigEntries(t, "db", "default", "dc1", connect.TestClusterID+".consul", "dc1", return discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", func(req *discoverychain.CompileRequest) {
func(req *discoverychain.CompileRequest) { // This is because structs.TestUpstreams uses an opaque config
// This is because structs.TestUpstreams uses an opaque config // to override connect timeouts.
// to override connect timeouts. req.OverrideConnectTimeout = 1 * time.Second
req.OverrideConnectTimeout = 1 * time.Second }, &structs.ServiceResolverConfigEntry{
}, Kind: structs.ServiceResolver,
&structs.ServiceResolverConfigEntry{ Name: "db",
Kind: structs.ServiceResolver, })
Name: "db",
},
)
} }
dbSplitChain := func() *structs.CompiledDiscoveryChain { dbSplitChain := func() *structs.CompiledDiscoveryChain {
return discoverychain.TestCompileConfigEntries(t, "db", "default", "dc1", "trustdomain.consul", "dc1", return discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", "trustdomain.consul", "dc1", func(req *discoverychain.CompileRequest) {
func(req *discoverychain.CompileRequest) { // This is because structs.TestUpstreams uses an opaque config
// This is because structs.TestUpstreams uses an opaque config // to override connect timeouts.
// to override connect timeouts. req.OverrideConnectTimeout = 1 * time.Second
req.OverrideConnectTimeout = 1 * time.Second }, &structs.ProxyConfigEntry{
Kind: structs.ProxyDefaults,
Name: structs.ProxyConfigGlobal,
Config: map[string]interface{}{
"protocol": "http",
}, },
&structs.ProxyConfigEntry{ }, &structs.ServiceResolverConfigEntry{
Kind: structs.ProxyDefaults, Kind: structs.ServiceResolver,
Name: structs.ProxyConfigGlobal, Name: "db",
Config: map[string]interface{}{ Subsets: map[string]structs.ServiceResolverSubset{
"protocol": "http", "v1": {
Filter: "Service.Meta.version == v1",
},
"v2": {
Filter: "Service.Meta.version == v2",
}, },
}, },
&structs.ServiceResolverConfigEntry{ }, &structs.ServiceSplitterConfigEntry{
Kind: structs.ServiceResolver, Kind: structs.ServiceSplitter,
Name: "db", Name: "db",
Subsets: map[string]structs.ServiceResolverSubset{ Splits: []structs.ServiceSplit{
"v1": { {Weight: 60, ServiceSubset: "v1"},
Filter: "Service.Meta.version == v1", {Weight: 40, ServiceSubset: "v2"},
},
"v2": {
Filter: "Service.Meta.version == v2",
},
},
}, },
&structs.ServiceSplitterConfigEntry{ })
Kind: structs.ServiceSplitter,
Name: "db",
Splits: []structs.ServiceSplit{
{Weight: 60, ServiceSubset: "v1"},
{Weight: 40, ServiceSubset: "v2"},
},
},
)
} }
upstreams := structs.TestUpstreams(t) upstreams := structs.TestUpstreams(t)
@ -157,6 +149,7 @@ func TestManager_BasicLifecycle(t *testing.T) {
Name: "db", Name: "db",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
// This is because structs.TestUpstreams uses an opaque config // This is because structs.TestUpstreams uses an opaque config
// to override connect timeouts. // to override connect timeouts.
OverrideConnectTimeout: 1 * time.Second, OverrideConnectTimeout: 1 * time.Second,
@ -225,7 +218,7 @@ func TestManager_BasicLifecycle(t *testing.T) {
WatchedUpstreams: nil, // Clone() clears this out WatchedUpstreams: nil, // Clone() clears this out
WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{ WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{
db.String(): { db.String(): {
"db.default.dc1": TestUpstreamNodes(t, db.Name), "db.default.default.dc1": TestUpstreamNodes(t, db.Name),
}, },
}, },
WatchedGateways: nil, // Clone() clears this out WatchedGateways: nil, // Clone() clears this out
@ -281,8 +274,8 @@ func TestManager_BasicLifecycle(t *testing.T) {
WatchedUpstreams: nil, // Clone() clears this out WatchedUpstreams: nil, // Clone() clears this out
WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{ WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{
db.String(): { db.String(): {
"v1.db.default.dc1": TestUpstreamNodes(t, db.Name), "v1.db.default.default.dc1": TestUpstreamNodes(t, db.Name),
"v2.db.default.dc1": TestUpstreamNodesAlternate(t), "v2.db.default.default.dc1": TestUpstreamNodesAlternate(t),
}, },
}, },
WatchedGateways: nil, // Clone() clears this out WatchedGateways: nil, // Clone() clears this out

View File

@ -488,6 +488,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "api", Name: "api",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{ OverrideMeshGateway: structs.MeshGatewayConfig{
Mode: meshGatewayProxyConfigValue, Mode: meshGatewayProxyConfigValue,
@ -497,6 +498,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "api-failover-remote", Name: "api-failover-remote",
EvaluateInDatacenter: "dc2", EvaluateInDatacenter: "dc2",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{ OverrideMeshGateway: structs.MeshGatewayConfig{
Mode: structs.MeshGatewayModeRemote, Mode: structs.MeshGatewayModeRemote,
@ -506,6 +508,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "api-failover-local", Name: "api-failover-local",
EvaluateInDatacenter: "dc2", EvaluateInDatacenter: "dc2",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{ OverrideMeshGateway: structs.MeshGatewayConfig{
Mode: structs.MeshGatewayModeLocal, Mode: structs.MeshGatewayModeLocal,
@ -515,6 +518,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "api-failover-direct", Name: "api-failover-direct",
EvaluateInDatacenter: "dc2", EvaluateInDatacenter: "dc2",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{ OverrideMeshGateway: structs.MeshGatewayConfig{
Mode: structs.MeshGatewayModeNone, Mode: structs.MeshGatewayModeNone,
@ -524,6 +528,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "api-dc2", Name: "api-dc2",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{ OverrideMeshGateway: structs.MeshGatewayConfig{
Mode: meshGatewayProxyConfigValue, Mode: meshGatewayProxyConfigValue,
@ -545,7 +550,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:api", CorrelationID: "discovery-chain:api",
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "api", "default", "dc1", "trustdomain.consul", "dc1", Chain: discoverychain.TestCompileConfigEntries(t, "api", "default", "default", "dc1", "trustdomain.consul", "dc1",
func(req *discoverychain.CompileRequest) { func(req *discoverychain.CompileRequest) {
req.OverrideMeshGateway.Mode = meshGatewayProxyConfigValue req.OverrideMeshGateway.Mode = meshGatewayProxyConfigValue
}), }),
@ -555,7 +560,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:api-failover-remote?dc=dc2", CorrelationID: "discovery-chain:api-failover-remote?dc=dc2",
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "api-failover-remote", "default", "dc2", "trustdomain.consul", "dc1", Chain: discoverychain.TestCompileConfigEntries(t, "api-failover-remote", "default", "default", "dc2", "trustdomain.consul", "dc1",
func(req *discoverychain.CompileRequest) { func(req *discoverychain.CompileRequest) {
req.OverrideMeshGateway.Mode = structs.MeshGatewayModeRemote req.OverrideMeshGateway.Mode = structs.MeshGatewayModeRemote
}), }),
@ -565,7 +570,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:api-failover-local?dc=dc2", CorrelationID: "discovery-chain:api-failover-local?dc=dc2",
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "api-failover-local", "default", "dc2", "trustdomain.consul", "dc1", Chain: discoverychain.TestCompileConfigEntries(t, "api-failover-local", "default", "default", "dc2", "trustdomain.consul", "dc1",
func(req *discoverychain.CompileRequest) { func(req *discoverychain.CompileRequest) {
req.OverrideMeshGateway.Mode = structs.MeshGatewayModeLocal req.OverrideMeshGateway.Mode = structs.MeshGatewayModeLocal
}), }),
@ -575,7 +580,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:api-failover-direct?dc=dc2", CorrelationID: "discovery-chain:api-failover-direct?dc=dc2",
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "api-failover-direct", "default", "dc2", "trustdomain.consul", "dc1", Chain: discoverychain.TestCompileConfigEntries(t, "api-failover-direct", "default", "default", "dc2", "trustdomain.consul", "dc1",
func(req *discoverychain.CompileRequest) { func(req *discoverychain.CompileRequest) {
req.OverrideMeshGateway.Mode = structs.MeshGatewayModeNone req.OverrideMeshGateway.Mode = structs.MeshGatewayModeNone
}), }),
@ -585,19 +590,17 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:api-dc2", CorrelationID: "discovery-chain:api-dc2",
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "api-dc2", "default", "dc1", "trustdomain.consul", "dc1", Chain: discoverychain.TestCompileConfigEntries(t, "api-dc2", "default", "default", "dc1", "trustdomain.consul", "dc1",
func(req *discoverychain.CompileRequest) { func(req *discoverychain.CompileRequest) {
req.OverrideMeshGateway.Mode = meshGatewayProxyConfigValue req.OverrideMeshGateway.Mode = meshGatewayProxyConfigValue
}, }, &structs.ServiceResolverConfigEntry{
&structs.ServiceResolverConfigEntry{
Kind: structs.ServiceResolver, Kind: structs.ServiceResolver,
Name: "api-dc2", Name: "api-dc2",
Redirect: &structs.ServiceResolverRedirect{ Redirect: &structs.ServiceResolverRedirect{
Service: "api", Service: "api",
Datacenter: "dc2", Datacenter: "dc2",
}, },
}, }),
),
}, },
Err: nil, Err: nil,
}, },
@ -624,12 +627,12 @@ func TestState_WatchesAndUpdates(t *testing.T) {
stage1 := verificationStage{ stage1 := verificationStage{
requiredWatches: map[string]verifyWatchRequest{ requiredWatches: map[string]verifyWatchRequest{
"upstream-target:api.default.dc1:api": genVerifyServiceWatch("api", "", "dc1", true), "upstream-target:api.default.default.dc1:api": genVerifyServiceWatch("api", "", "dc1", true),
"upstream-target:api-failover-remote.default.dc2:api-failover-remote?dc=dc2": genVerifyServiceWatch("api-failover-remote", "", "dc2", true), "upstream-target:api-failover-remote.default.default.dc2:api-failover-remote?dc=dc2": genVerifyServiceWatch("api-failover-remote", "", "dc2", true),
"upstream-target:api-failover-local.default.dc2:api-failover-local?dc=dc2": genVerifyServiceWatch("api-failover-local", "", "dc2", true), "upstream-target:api-failover-local.default.default.dc2:api-failover-local?dc=dc2": genVerifyServiceWatch("api-failover-local", "", "dc2", true),
"upstream-target:api-failover-direct.default.dc2:api-failover-direct?dc=dc2": genVerifyServiceWatch("api-failover-direct", "", "dc2", true), "upstream-target:api-failover-direct.default.default.dc2:api-failover-direct?dc=dc2": genVerifyServiceWatch("api-failover-direct", "", "dc2", true),
"mesh-gateway:dc2:api-failover-remote?dc=dc2": genVerifyGatewayWatch("dc2"), "mesh-gateway:dc2:api-failover-remote?dc=dc2": genVerifyGatewayWatch("dc2"),
"mesh-gateway:dc1:api-failover-local?dc=dc2": genVerifyGatewayWatch("dc1"), "mesh-gateway:dc1:api-failover-local?dc=dc2": genVerifyGatewayWatch("dc1"),
}, },
verifySnapshot: func(t testing.TB, snap *ConfigSnapshot) { verifySnapshot: func(t testing.TB, snap *ConfigSnapshot) {
require.True(t, snap.Valid()) require.True(t, snap.Valid())
@ -1003,6 +1006,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "api", Name: "api",
EvaluateInDatacenter: "dc1", EvaluateInDatacenter: "dc1",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
}), }),
}, },
@ -1010,7 +1014,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:" + api.String(), CorrelationID: "discovery-chain:" + api.String(),
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "api", "default", "dc1", "trustdomain.consul", "dc1", nil), Chain: discoverychain.TestCompileConfigEntries(t, "api", "default", "default", "dc1", "trustdomain.consul", "dc1", nil),
}, },
Err: nil, Err: nil,
}, },
@ -1022,11 +1026,11 @@ func TestState_WatchesAndUpdates(t *testing.T) {
}, },
{ {
requiredWatches: map[string]verifyWatchRequest{ requiredWatches: map[string]verifyWatchRequest{
"upstream-target:api.default.dc1:" + api.String(): genVerifyServiceWatch("api", "", "dc1", true), "upstream-target:api.default.default.dc1:" + api.String(): genVerifyServiceWatch("api", "", "dc1", true),
}, },
events: []cache.UpdateEvent{ events: []cache.UpdateEvent{
{ {
CorrelationID: "upstream-target:api.default.dc1:" + api.String(), CorrelationID: "upstream-target:api.default.default.dc1:" + api.String(),
Result: &structs.IndexedCheckServiceNodes{ Result: &structs.IndexedCheckServiceNodes{
Nodes: structs.CheckServiceNodes{ Nodes: structs.CheckServiceNodes{
{ {
@ -1048,8 +1052,8 @@ func TestState_WatchesAndUpdates(t *testing.T) {
require.Len(t, snap.IngressGateway.WatchedUpstreamEndpoints, 1) require.Len(t, snap.IngressGateway.WatchedUpstreamEndpoints, 1)
require.Contains(t, snap.IngressGateway.WatchedUpstreamEndpoints, api.String()) require.Contains(t, snap.IngressGateway.WatchedUpstreamEndpoints, api.String())
require.Len(t, snap.IngressGateway.WatchedUpstreamEndpoints[api.String()], 1) require.Len(t, snap.IngressGateway.WatchedUpstreamEndpoints[api.String()], 1)
require.Contains(t, snap.IngressGateway.WatchedUpstreamEndpoints[api.String()], "api.default.dc1") require.Contains(t, snap.IngressGateway.WatchedUpstreamEndpoints[api.String()], "api.default.default.dc1")
require.Equal(t, snap.IngressGateway.WatchedUpstreamEndpoints[api.String()]["api.default.dc1"], require.Equal(t, snap.IngressGateway.WatchedUpstreamEndpoints[api.String()]["api.default.default.dc1"],
structs.CheckServiceNodes{ structs.CheckServiceNodes{
{ {
Node: &structs.Node{ Node: &structs.Node{
@ -1752,7 +1756,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:" + db.String(), CorrelationID: "discovery-chain:" + db.String(),
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "db", "default", "dc1", "trustdomain.consul", "dc1", nil), Chain: discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", "trustdomain.consul", "dc1", nil),
}, },
Err: nil, Err: nil,
}, },
@ -1764,11 +1768,11 @@ func TestState_WatchesAndUpdates(t *testing.T) {
}, },
{ {
requiredWatches: map[string]verifyWatchRequest{ requiredWatches: map[string]verifyWatchRequest{
"upstream-target:db.default.dc1:" + db.String(): genVerifyServiceWatch("db", "", "dc1", true), "upstream-target:db.default.default.dc1:" + db.String(): genVerifyServiceWatch("db", "", "dc1", true),
}, },
events: []cache.UpdateEvent{ events: []cache.UpdateEvent{
{ {
CorrelationID: "upstream-target:db.default.dc1:" + db.String(), CorrelationID: "upstream-target:db.default.default.dc1:" + db.String(),
Result: &structs.IndexedCheckServiceNodes{ Result: &structs.IndexedCheckServiceNodes{
Nodes: structs.CheckServiceNodes{ Nodes: structs.CheckServiceNodes{
{ {
@ -1819,8 +1823,8 @@ func TestState_WatchesAndUpdates(t *testing.T) {
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints, 1) require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints, 1)
require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, db.String()) require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints, db.String())
require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[db.String()], 1) require.Len(t, snap.ConnectProxy.WatchedUpstreamEndpoints[db.String()], 1)
require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints[db.String()], "db.default.dc1") require.Contains(t, snap.ConnectProxy.WatchedUpstreamEndpoints[db.String()], "db.default.default.dc1")
require.Equal(t, snap.ConnectProxy.WatchedUpstreamEndpoints[db.String()]["db.default.dc1"], require.Equal(t, snap.ConnectProxy.WatchedUpstreamEndpoints[db.String()]["db.default.default.dc1"],
structs.CheckServiceNodes{ structs.CheckServiceNodes{
{ {
Node: &structs.Node{ Node: &structs.Node{
@ -1900,15 +1904,13 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:" + db.String(), CorrelationID: "discovery-chain:" + db.String(),
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "db", "default", "dc1", "trustdomain.consul", "dc1", nil, Chain: discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", "trustdomain.consul", "dc1", nil, &structs.ServiceResolverConfigEntry{
&structs.ServiceResolverConfigEntry{ Kind: structs.ServiceResolver,
Kind: structs.ServiceResolver, Name: "db",
Name: "db", Redirect: &structs.ServiceResolverRedirect{
Redirect: &structs.ServiceResolverRedirect{ Service: "mysql",
Service: "mysql",
},
}, },
), }),
}, },
Err: nil, Err: nil,
}, },
@ -1919,8 +1921,8 @@ func TestState_WatchesAndUpdates(t *testing.T) {
// In transparent mode we watch the upstream's endpoints even if the upstream is not a target of its chain. // In transparent mode we watch the upstream's endpoints even if the upstream is not a target of its chain.
// This will happen in cases like redirects. // This will happen in cases like redirects.
require.Contains(t, snap.ConnectProxy.WatchedUpstreams[db.String()], "db.default.dc1") require.Contains(t, snap.ConnectProxy.WatchedUpstreams[db.String()], "db.default.default.dc1")
require.Contains(t, snap.ConnectProxy.WatchedUpstreams[db.String()], "mysql.default.dc1") require.Contains(t, snap.ConnectProxy.WatchedUpstreams[db.String()], "mysql.default.default.dc1")
}, },
}, },
// Empty list of upstreams should clean everything up // Empty list of upstreams should clean everything up
@ -1999,6 +2001,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "db", Name: "db",
EvaluateInDatacenter: "dc2", EvaluateInDatacenter: "dc2",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{Mode: structs.MeshGatewayModeLocal}, OverrideMeshGateway: structs.MeshGatewayConfig{Mode: structs.MeshGatewayModeLocal},
}), }),
@ -2060,6 +2063,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "db", Name: "db",
EvaluateInDatacenter: "dc2", EvaluateInDatacenter: "dc2",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{Mode: structs.MeshGatewayModeLocal}, OverrideMeshGateway: structs.MeshGatewayConfig{Mode: structs.MeshGatewayModeLocal},
}), }),
@ -2068,7 +2072,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
{ {
CorrelationID: "discovery-chain:" + upstreamIDForDC2(db.String()), CorrelationID: "discovery-chain:" + upstreamIDForDC2(db.String()),
Result: &structs.DiscoveryChainResponse{ Result: &structs.DiscoveryChainResponse{
Chain: discoverychain.TestCompileConfigEntries(t, "db", "default", "dc2", "trustdomain.consul", "dc1", Chain: discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc2", "trustdomain.consul", "dc1",
func(req *discoverychain.CompileRequest) { func(req *discoverychain.CompileRequest) {
req.OverrideMeshGateway.Mode = structs.MeshGatewayModeLocal req.OverrideMeshGateway.Mode = structs.MeshGatewayModeLocal
}), }),
@ -2096,6 +2100,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
Name: "db", Name: "db",
EvaluateInDatacenter: "dc2", EvaluateInDatacenter: "dc2",
EvaluateInNamespace: "default", EvaluateInNamespace: "default",
EvaluateInPartition: "default",
Datacenter: "dc1", Datacenter: "dc1",
OverrideMeshGateway: structs.MeshGatewayConfig{Mode: structs.MeshGatewayModeLocal}, OverrideMeshGateway: structs.MeshGatewayConfig{Mode: structs.MeshGatewayModeLocal},
}), }),

View File

@ -669,9 +669,7 @@ func TestConfigSnapshot(t testing.T) *ConfigSnapshot {
roots, leaf := TestCerts(t) roots, leaf := TestCerts(t)
// no entries implies we'll get a default chain // no entries implies we'll get a default chain
dbChain := discoverychain.TestCompileConfigEntries( dbChain := discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "db", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
upstreams := structs.TestUpstreams(t) upstreams := structs.TestUpstreams(t)
@ -701,7 +699,7 @@ func TestConfigSnapshot(t testing.T) *ConfigSnapshot {
}, },
WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{ WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{
"db": { "db": {
"db.default.dc1": TestUpstreamNodes(t, "db"), "db.default.default.dc1": TestUpstreamNodes(t, "db"),
}, },
}, },
}, },
@ -1345,9 +1343,7 @@ func setupTestVariationConfigEntriesAndSnapshot(
entries = append(entries, additionalEntries...) entries = append(entries, additionalEntries...)
} }
dbChain := discoverychain.TestCompileConfigEntries( dbChain := discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", compileSetup, entries...)
t, "db", "default", "dc1",
connect.TestClusterID+".consul", "dc1", compileSetup, entries...)
upstreams := structs.TestUpstreams(t) upstreams := structs.TestUpstreams(t)
snap := ConfigSnapshotUpstreams{ snap := ConfigSnapshotUpstreams{
@ -1357,7 +1353,7 @@ func setupTestVariationConfigEntriesAndSnapshot(
}, },
WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{ WatchedUpstreamEndpoints: map[string]map[string]structs.CheckServiceNodes{
"db": { "db": {
"db.default.dc1": TestUpstreamNodes(t, "db"), "db.default.default.dc1": TestUpstreamNodes(t, "db"),
}, },
}, },
UpstreamConfig: upstreams.ToMap(), UpstreamConfig: upstreams.ToMap(),
@ -1369,14 +1365,14 @@ func setupTestVariationConfigEntriesAndSnapshot(
case "simple": case "simple":
case "external-sni": case "external-sni":
case "failover": case "failover":
snap.WatchedUpstreamEndpoints["db"]["fail.default.dc1"] = snap.WatchedUpstreamEndpoints["db"]["fail.default.default.dc1"] =
TestUpstreamNodesAlternate(t) TestUpstreamNodesAlternate(t)
case "failover-through-remote-gateway-triggered": case "failover-through-remote-gateway-triggered":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc1"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc1"] =
TestUpstreamNodesInStatus(t, "critical") TestUpstreamNodesInStatus(t, "critical")
fallthrough fallthrough
case "failover-through-remote-gateway": case "failover-through-remote-gateway":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc2"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc2"] =
TestUpstreamNodesDC2(t) TestUpstreamNodesDC2(t)
snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{ snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{
"db": { "db": {
@ -1384,13 +1380,13 @@ func setupTestVariationConfigEntriesAndSnapshot(
}, },
} }
case "failover-through-double-remote-gateway-triggered": case "failover-through-double-remote-gateway-triggered":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc1"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc1"] =
TestUpstreamNodesInStatus(t, "critical") TestUpstreamNodesInStatus(t, "critical")
snap.WatchedUpstreamEndpoints["db"]["db.default.dc2"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc2"] =
TestUpstreamNodesInStatusDC2(t, "critical") TestUpstreamNodesInStatusDC2(t, "critical")
fallthrough fallthrough
case "failover-through-double-remote-gateway": case "failover-through-double-remote-gateway":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc3"] = TestUpstreamNodesDC2(t) snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc3"] = TestUpstreamNodesDC2(t)
snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{ snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{
"db": { "db": {
"dc2": TestGatewayNodesDC2(t), "dc2": TestGatewayNodesDC2(t),
@ -1398,11 +1394,11 @@ func setupTestVariationConfigEntriesAndSnapshot(
}, },
} }
case "failover-through-local-gateway-triggered": case "failover-through-local-gateway-triggered":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc1"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc1"] =
TestUpstreamNodesInStatus(t, "critical") TestUpstreamNodesInStatus(t, "critical")
fallthrough fallthrough
case "failover-through-local-gateway": case "failover-through-local-gateway":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc2"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc2"] =
TestUpstreamNodesDC2(t) TestUpstreamNodesDC2(t)
snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{ snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{
"db": { "db": {
@ -1410,13 +1406,13 @@ func setupTestVariationConfigEntriesAndSnapshot(
}, },
} }
case "failover-through-double-local-gateway-triggered": case "failover-through-double-local-gateway-triggered":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc1"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc1"] =
TestUpstreamNodesInStatus(t, "critical") TestUpstreamNodesInStatus(t, "critical")
snap.WatchedUpstreamEndpoints["db"]["db.default.dc2"] = snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc2"] =
TestUpstreamNodesInStatusDC2(t, "critical") TestUpstreamNodesInStatusDC2(t, "critical")
fallthrough fallthrough
case "failover-through-double-local-gateway": case "failover-through-double-local-gateway":
snap.WatchedUpstreamEndpoints["db"]["db.default.dc3"] = TestUpstreamNodesDC2(t) snap.WatchedUpstreamEndpoints["db"]["db.default.default.dc3"] = TestUpstreamNodesDC2(t)
snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{ snap.WatchedGatewayEndpoints = map[string]map[string]structs.CheckServiceNodes{
"db": { "db": {
"dc1": TestGatewayNodesDC1(t), "dc1": TestGatewayNodesDC1(t),
@ -1424,18 +1420,18 @@ func setupTestVariationConfigEntriesAndSnapshot(
} }
case "splitter-with-resolver-redirect-multidc": case "splitter-with-resolver-redirect-multidc":
snap.WatchedUpstreamEndpoints["db"] = map[string]structs.CheckServiceNodes{ snap.WatchedUpstreamEndpoints["db"] = map[string]structs.CheckServiceNodes{
"v1.db.default.dc1": TestUpstreamNodes(t, "db"), "v1.db.default.default.dc1": TestUpstreamNodes(t, "db"),
"v2.db.default.dc2": TestUpstreamNodesDC2(t), "v2.db.default.default.dc2": TestUpstreamNodesDC2(t),
} }
case "chain-and-splitter": case "chain-and-splitter":
case "grpc-router": case "grpc-router":
case "chain-and-router": case "chain-and-router":
case "http-multiple-services": case "http-multiple-services":
snap.WatchedUpstreamEndpoints["foo"] = map[string]structs.CheckServiceNodes{ snap.WatchedUpstreamEndpoints["foo"] = map[string]structs.CheckServiceNodes{
"foo.default.dc1": TestUpstreamNodes(t, "foo"), "foo.default.default.dc1": TestUpstreamNodes(t, "foo"),
} }
snap.WatchedUpstreamEndpoints["bar"] = map[string]structs.CheckServiceNodes{ snap.WatchedUpstreamEndpoints["bar"] = map[string]structs.CheckServiceNodes{
"bar.default.dc1": TestUpstreamNodesAlternate(t), "bar.default.default.dc1": TestUpstreamNodesAlternate(t),
} }
case "lb-resolver": case "lb-resolver":
default: default:
@ -2017,8 +2013,8 @@ func TestConfigSnapshotIngress_MultipleListenersDuplicateService(t testing.T) *C
}, },
} }
fooChain := discoverychain.TestCompileConfigEntries(t, "foo", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil) fooChain := discoverychain.TestCompileConfigEntries(t, "foo", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
barChain := discoverychain.TestCompileConfigEntries(t, "bar", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil) barChain := discoverychain.TestCompileConfigEntries(t, "bar", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
snap.IngressGateway.DiscoveryChain = map[string]*structs.CompiledDiscoveryChain{ snap.IngressGateway.DiscoveryChain = map[string]*structs.CompiledDiscoveryChain{
"foo": fooChain, "foo": fooChain,

View File

@ -224,8 +224,7 @@ func (s *handlerUpstreams) resetWatchesFromChain(
// Outside of transparent mode we only watch the chain target, B, // Outside of transparent mode we only watch the chain target, B,
// since A is a virtual service and traffic will not be sent to it. // since A is a virtual service and traffic will not be sent to it.
if !watchedChainEndpoints && s.proxyCfg.Mode == structs.ProxyModeTransparent { if !watchedChainEndpoints && s.proxyCfg.Mode == structs.ProxyModeTransparent {
// TODO(partitions): add partition to the disco chain chainEntMeta := structs.NewEnterpriseMetaWithPartition(chain.Partition, chain.Namespace)
chainEntMeta := structs.NewEnterpriseMetaWithPartition("" /*TODO*/, chain.Namespace)
opts := targetWatchOpts{ opts := targetWatchOpts{
upstreamID: id, upstreamID: id,
@ -358,6 +357,7 @@ func (s *handlerUpstreams) watchDiscoveryChain(ctx context.Context, snap *Config
Name: opts.name, Name: opts.name,
EvaluateInDatacenter: opts.datacenter, EvaluateInDatacenter: opts.datacenter,
EvaluateInNamespace: opts.namespace, EvaluateInNamespace: opts.namespace,
EvaluateInPartition: opts.partition,
OverrideProtocol: opts.cfg.Protocol, OverrideProtocol: opts.cfg.Protocol,
OverrideConnectTimeout: opts.cfg.ConnectTimeout(), OverrideConnectTimeout: opts.cfg.ConnectTimeout(),
OverrideMeshGateway: opts.meshGateway, OverrideMeshGateway: opts.meshGateway,

View File

@ -379,8 +379,6 @@ type ServiceRouteDestination struct {
// splitting. // splitting.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
// NOTE: Partition is not represented here by design. Do not add it.
// PrefixRewrite allows for the proxied request to have its matching path // PrefixRewrite allows for the proxied request to have its matching path
// prefix modified before being sent to the destination. Described more // prefix modified before being sent to the destination. Described more
// below in the envoy implementation section. // below in the envoy implementation section.
@ -660,8 +658,6 @@ type ServiceSplit struct {
// If this field is specified then this route is ineligible for further // If this field is specified then this route is ineligible for further
// splitting. // splitting.
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
// NOTE: Partition is not represented here by design. Do not add it.
} }
// ServiceResolverConfigEntry defines which instances of a service should // ServiceResolverConfigEntry defines which instances of a service should
@ -846,6 +842,9 @@ func (e *ServiceResolverConfigEntry) Validate() error {
} }
if e.Redirect != nil { if e.Redirect != nil {
if e.PartitionOrEmpty() != acl.DefaultPartitionName && e.Redirect.Datacenter != "" {
return fmt.Errorf("Cross datacenters redirect is not allowed for non default partition")
}
r := e.Redirect r := e.Redirect
if len(e.Failover) > 0 { if len(e.Failover) > 0 {
@ -873,7 +872,11 @@ func (e *ServiceResolverConfigEntry) Validate() error {
} }
if len(e.Failover) > 0 { if len(e.Failover) > 0 {
for subset, f := range e.Failover { for subset, f := range e.Failover {
if e.PartitionOrEmpty() != acl.DefaultPartitionName && len(f.Datacenters) != 0 {
return fmt.Errorf("Cross datacenters failover is not allowed for non default partition")
}
if subset != "*" && !isSubset(subset) { if subset != "*" && !isSubset(subset) {
return fmt.Errorf("Bad Failover[%q]: not a valid subset", subset) return fmt.Errorf("Bad Failover[%q]: not a valid subset", subset)
} }
@ -988,6 +991,7 @@ func (e *ServiceResolverConfigEntry) ListRelatedServices() []ServiceID {
if redirectID != svcID { if redirectID != svcID {
found[redirectID] = struct{}{} found[redirectID] = struct{}{}
} }
} }
if len(e.Failover) > 0 { if len(e.Failover) > 0 {
@ -1052,8 +1056,6 @@ type ServiceResolverRedirect struct {
// Datacenter is the datacenter to resolve the service from instead of the // Datacenter is the datacenter to resolve the service from instead of the
// current one (optional). // current one (optional).
Datacenter string `json:",omitempty"` Datacenter string `json:",omitempty"`
// NOTE: Partition is not represented here by design. Do not add it.
} }
// There are some restrictions on what is allowed in here: // There are some restrictions on what is allowed in here:
@ -1088,8 +1090,6 @@ type ServiceResolverFailover struct {
// //
// This is a DESTINATION during failover. // This is a DESTINATION during failover.
Datacenters []string `json:",omitempty"` Datacenters []string `json:",omitempty"`
// NOTE: Partition is not represented here by design. Do not add it.
} }
// LoadBalancer determines the load balancing policy and configuration for services // LoadBalancer determines the load balancing policy and configuration for services
@ -1345,8 +1345,6 @@ type DiscoveryChainRequest struct {
EvaluateInNamespace string EvaluateInNamespace string
EvaluateInPartition string EvaluateInPartition string
// NOTE: Partition is not represented here by design. Do not add it.
// OverrideMeshGateway allows for the mesh gateway setting to be overridden // OverrideMeshGateway allows for the mesh gateway setting to be overridden
// for any resolver in the compiled chain. // for any resolver in the compiled chain.
OverrideMeshGateway MeshGatewayConfig OverrideMeshGateway MeshGatewayConfig

View File

@ -14,6 +14,7 @@ import (
type CompiledDiscoveryChain struct { type CompiledDiscoveryChain struct {
ServiceName string ServiceName string
Namespace string // the namespace that the chain was compiled within Namespace string // the namespace that the chain was compiled within
Partition string // the partition that the chain was compiled within
Datacenter string // the datacenter that the chain was compiled within Datacenter string // the datacenter that the chain was compiled within
// CustomizationHash is a unique hash of any data that affects the // CustomizationHash is a unique hash of any data that affects the
@ -85,17 +86,17 @@ func (c *CompiledDiscoveryChain) IsDefault() bool {
target := c.Targets[node.Resolver.Target] target := c.Targets[node.Resolver.Target]
return target.Service == c.ServiceName && target.Namespace == c.Namespace return target.Service == c.ServiceName && target.Namespace == c.Namespace && target.Partition == c.Partition
} }
// ID returns an ID that encodes the service, namespace, and datacenter. // ID returns an ID that encodes the service, namespace, partition, and datacenter.
// This ID allows us to compare a discovery chain target to the chain upstream itself. // This ID allows us to compare a discovery chain target to the chain upstream itself.
func (c *CompiledDiscoveryChain) ID() string { func (c *CompiledDiscoveryChain) ID() string {
return chainID("", c.ServiceName, c.Namespace, c.Datacenter) return chainID("", c.ServiceName, c.Namespace, c.Partition, c.Datacenter)
} }
func (c *CompiledDiscoveryChain) CompoundServiceName() ServiceName { func (c *CompiledDiscoveryChain) CompoundServiceName() ServiceName {
entMeta := NewEnterpriseMetaInDefaultPartition(c.Namespace) entMeta := NewEnterpriseMetaWithPartition(c.Partition, c.Namespace)
return NewServiceName(c.ServiceName, &entMeta) return NewServiceName(c.ServiceName, &entMeta)
} }
@ -230,27 +231,28 @@ type DiscoveryTarget struct {
Name string `json:",omitempty"` Name string `json:",omitempty"`
} }
func NewDiscoveryTarget(service, serviceSubset, namespace, datacenter string) *DiscoveryTarget { func NewDiscoveryTarget(service, serviceSubset, namespace, partition, datacenter string) *DiscoveryTarget {
t := &DiscoveryTarget{ t := &DiscoveryTarget{
Service: service, Service: service,
ServiceSubset: serviceSubset, ServiceSubset: serviceSubset,
Namespace: namespace, Namespace: namespace,
Partition: partition,
Datacenter: datacenter, Datacenter: datacenter,
} }
t.setID() t.setID()
return t return t
} }
func chainID(subset, service, namespace, dc string) string { func chainID(subset, service, namespace, partition, dc string) string {
// NOTE: this format is similar to the SNI syntax for simplicity // NOTE: this format is similar to the SNI syntax for simplicity
if subset == "" { if subset == "" {
return fmt.Sprintf("%s.%s.%s", service, namespace, dc) return fmt.Sprintf("%s.%s.%s.%s", service, namespace, partition, dc)
} }
return fmt.Sprintf("%s.%s.%s.%s", subset, service, namespace, dc) return fmt.Sprintf("%s.%s.%s.%s.%s", subset, service, namespace, partition, dc)
} }
func (t *DiscoveryTarget) setID() { func (t *DiscoveryTarget) setID() {
t.ID = chainID(t.ServiceSubset, t.Service, t.Namespace, t.Datacenter) t.ID = chainID(t.ServiceSubset, t.Service, t.Namespace, t.Partition, t.Datacenter)
} }
func (t *DiscoveryTarget) String() string { func (t *DiscoveryTarget) String() string {

View File

@ -1250,6 +1250,17 @@ func (s *NodeService) Validate() error {
bindAddrs = make(map[string]struct{}) bindAddrs = make(map[string]struct{})
) )
for _, u := range s.Proxy.Upstreams { for _, u := range s.Proxy.Upstreams {
destinationPartition := u.DestinationPartition
if destinationPartition == "" {
destinationPartition = acl.DefaultPartitionName
}
// cross DC Upstreams are only allowed for non "default" partitions
if u.Datacenter != "" && (destinationPartition != acl.DefaultPartitionName || s.PartitionOrDefault() != "default") {
result = multierror.Append(result, fmt.Errorf(
"upstreams cannot target another datacenter in non default partition"))
continue
}
if err := u.Validate(); err != nil { if err := u.Validate(); err != nil {
result = multierror.Append(result, err) result = multierror.Append(result, err)
continue continue

View File

@ -790,6 +790,21 @@ func TestStructs_NodeService_ValidateConnectProxy(t *testing.T) {
}, },
"", "",
}, },
{
"connect-proxy: Upstreams non default partition another dc",
func(x *NodeService) {
x.Proxy.Upstreams = Upstreams{
{ // baseline
DestinationType: UpstreamDestTypeService,
DestinationName: "foo",
DestinationPartition: "foo",
Datacenter: "dc1",
LocalBindPort: 5000,
},
}
},
"upstreams cannot target another datacenter in non default partition",
},
{ {
"connect-proxy: Upstreams duplicated by port", "connect-proxy: Upstreams duplicated by port",
func(x *NodeService) { func(x *NodeService) {
@ -942,6 +957,65 @@ func TestStructs_NodeService_ValidateConnectProxy(t *testing.T) {
} }
} }
func TestStructs_NodeService_ValidateConnectProxy_In_Partition(t *testing.T) {
cases := []struct {
Name string
Modify func(*NodeService)
Err string
}{
{
"valid",
func(x *NodeService) {},
"",
},
{
"connect-proxy: Upstreams non default partition another dc",
func(x *NodeService) {
x.Proxy.Upstreams = Upstreams{
{ // baseline
DestinationType: UpstreamDestTypeService,
DestinationName: "foo",
DestinationPartition: "foo",
Datacenter: "dc1",
LocalBindPort: 5000,
},
}
},
"upstreams cannot target another datacenter in non default partition",
},
{
"connect-proxy: Upstreams non default partition same dc",
func(x *NodeService) {
x.Proxy.Upstreams = Upstreams{
{ // baseline
DestinationType: UpstreamDestTypeService,
DestinationName: "foo",
DestinationPartition: "foo",
LocalBindPort: 5000,
},
}
},
"",
},
}
for _, tc := range cases {
t.Run(tc.Name, func(t *testing.T) {
assert := assert.New(t)
ns := TestNodeServiceProxyInPartition(t, "bar")
tc.Modify(ns)
err := ns.Validate()
assert.Equal(err != nil, tc.Err != "", err)
if err == nil {
return
}
assert.Contains(strings.ToLower(err.Error()), strings.ToLower(tc.Err))
})
}
}
func TestStructs_NodeService_ValidateSidecarService(t *testing.T) { func TestStructs_NodeService_ValidateSidecarService(t *testing.T) {
cases := []struct { cases := []struct {
Name string Name string

View File

@ -56,12 +56,18 @@ func TestNodeServiceWithName(t testing.T, name string) *NodeService {
// TestNodeServiceProxy returns a *NodeService representing a valid // TestNodeServiceProxy returns a *NodeService representing a valid
// Connect proxy. // Connect proxy.
func TestNodeServiceProxy(t testing.T) *NodeService { func TestNodeServiceProxy(t testing.T) *NodeService {
return TestNodeServiceProxyInPartition(t, "")
}
func TestNodeServiceProxyInPartition(t testing.T, partition string) *NodeService {
entMeta := DefaultEnterpriseMetaInPartition(partition)
return &NodeService{ return &NodeService{
Kind: ServiceKindConnectProxy, Kind: ServiceKindConnectProxy,
Service: "web-proxy", Service: "web-proxy",
Address: "127.0.0.2", Address: "127.0.0.2",
Port: 2222, Port: 2222,
Proxy: TestConnectProxyConfig(t), Proxy: TestConnectProxyConfig(t),
EnterpriseMeta: *entMeta,
} }
} }

View File

@ -697,9 +697,7 @@ func TestClustersFromSnapshot(t *testing.T) {
} }
// There should still be a cluster for non-passthrough requests // There should still be a cluster for non-passthrough requests
snap.ConnectProxy.DiscoveryChain["mongo"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["mongo"] = discoverychain.TestCompileConfigEntries(t, "mongo", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "mongo", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
snap.ConnectProxy.WatchedUpstreamEndpoints["mongo"] = map[string]structs.CheckServiceNodes{ snap.ConnectProxy.WatchedUpstreamEndpoints["mongo"] = map[string]structs.CheckServiceNodes{
"mongo.default.dc1": { "mongo.default.dc1": {
structs.CheckServiceNode{ structs.CheckServiceNode{

View File

@ -179,7 +179,7 @@ func TestServer_DeltaAggregatedResources_v3_BasicProtocol_TCP(t *testing.T) {
// now reconfigure the snapshot and JUST edit the endpoints to strike one of the two current endpoints for DB // now reconfigure the snapshot and JUST edit the endpoints to strike one of the two current endpoints for DB
snap = newTestSnapshot(t, snap, "") snap = newTestSnapshot(t, snap, "")
deleteAllButOneEndpoint(snap, "db", "db.default.dc1") deleteAllButOneEndpoint(snap, "db", "db.default.default.dc1")
mgr.DeliverConfig(t, sid, snap) mgr.DeliverConfig(t, sid, snap)
// We never send an EDS reply about this change. // We never send an EDS reply about this change.
@ -216,7 +216,7 @@ func TestServer_DeltaAggregatedResources_v3_BasicProtocol_TCP(t *testing.T) {
runStep(t, "simulate envoy NACKing an endpoint update", func(t *testing.T) { runStep(t, "simulate envoy NACKing an endpoint update", func(t *testing.T) {
// Trigger only an EDS update. // Trigger only an EDS update.
snap = newTestSnapshot(t, snap, "") snap = newTestSnapshot(t, snap, "")
deleteAllButOneEndpoint(snap, "db", "db.default.dc1") deleteAllButOneEndpoint(snap, "db", "db.default.default.dc1")
mgr.DeliverConfig(t, sid, snap) mgr.DeliverConfig(t, sid, snap)
// Send envoy an EDS update. // Send envoy an EDS update.

View File

@ -15,22 +15,22 @@ func TestFirstHealthyTarget(t *testing.T) {
warning := proxycfg.TestUpstreamNodesInStatus(t, "warning") warning := proxycfg.TestUpstreamNodesInStatus(t, "warning")
critical := proxycfg.TestUpstreamNodesInStatus(t, "critical") critical := proxycfg.TestUpstreamNodesInStatus(t, "critical")
warnOnlyPassingTarget := structs.NewDiscoveryTarget("all-warn", "", "default", "dc1") warnOnlyPassingTarget := structs.NewDiscoveryTarget("all-warn", "", "default", "default", "dc1")
warnOnlyPassingTarget.Subset.OnlyPassing = true warnOnlyPassingTarget.Subset.OnlyPassing = true
failOnlyPassingTarget := structs.NewDiscoveryTarget("all-fail", "", "default", "dc1") failOnlyPassingTarget := structs.NewDiscoveryTarget("all-fail", "", "default", "default", "dc1")
failOnlyPassingTarget.Subset.OnlyPassing = true failOnlyPassingTarget.Subset.OnlyPassing = true
targets := map[string]*structs.DiscoveryTarget{ targets := map[string]*structs.DiscoveryTarget{
"all-ok.default.dc1": structs.NewDiscoveryTarget("all-ok", "", "default", "dc1"), "all-ok.default.dc1": structs.NewDiscoveryTarget("all-ok", "", "default", "default", "dc1"),
"all-warn.default.dc1": structs.NewDiscoveryTarget("all-warn", "", "default", "dc1"), "all-warn.default.dc1": structs.NewDiscoveryTarget("all-warn", "", "default", "default", "dc1"),
"all-fail.default.dc1": structs.NewDiscoveryTarget("all-fail", "", "default", "dc1"), "all-fail.default.default.dc1": structs.NewDiscoveryTarget("all-fail", "", "default", "default", "dc1"),
"all-warn-onlypassing.default.dc1": warnOnlyPassingTarget, "all-warn-onlypassing.default.dc1": warnOnlyPassingTarget,
"all-fail-onlypassing.default.dc1": failOnlyPassingTarget, "all-fail-onlypassing.default.dc1": failOnlyPassingTarget,
} }
targetHealth := map[string]structs.CheckServiceNodes{ targetHealth := map[string]structs.CheckServiceNodes{
"all-ok.default.dc1": passing, "all-ok.default.dc1": passing,
"all-warn.default.dc1": warning, "all-warn.default.dc1": warning,
"all-fail.default.dc1": critical, "all-fail.default.default.dc1": critical,
"all-warn-onlypassing.default.dc1": warning, "all-warn-onlypassing.default.dc1": warning,
"all-fail-onlypassing.default.dc1": critical, "all-fail-onlypassing.default.dc1": critical,
} }
@ -49,8 +49,8 @@ func TestFirstHealthyTarget(t *testing.T) {
expect: "all-warn.default.dc1", expect: "all-warn.default.dc1",
}, },
{ {
primary: "all-fail.default.dc1", primary: "all-fail.default.default.dc1",
expect: "all-fail.default.dc1", expect: "all-fail.default.default.dc1",
}, },
{ {
primary: "all-warn-onlypassing.default.dc1", primary: "all-warn-onlypassing.default.dc1",
@ -82,7 +82,7 @@ func TestFirstHealthyTarget(t *testing.T) {
expect: "all-ok.default.dc1", expect: "all-ok.default.dc1",
}, },
{ {
primary: "all-fail.default.dc1", primary: "all-fail.default.default.dc1",
secondary: []string{ secondary: []string{
"all-ok.default.dc1", "all-ok.default.dc1",
}, },
@ -96,7 +96,7 @@ func TestFirstHealthyTarget(t *testing.T) {
expect: "all-ok.default.dc1", expect: "all-ok.default.dc1",
}, },
{ {
primary: "all-fail.default.dc1", primary: "all-fail.default.default.dc1",
secondary: []string{ secondary: []string{
"all-warn-onlypassing.default.dc1", "all-warn-onlypassing.default.dc1",
"all-warn.default.dc1", "all-warn.default.dc1",

View File

@ -1134,7 +1134,7 @@ func (s *ResourceGenerator) makeFilterChainTerminatingGateway(
// HTTP filter to do intention checks here instead. // HTTP filter to do intention checks here instead.
opts := listenerFilterOpts{ opts := listenerFilterOpts{
protocol: protocol, protocol: protocol,
filterName: fmt.Sprintf("%s.%s.%s", service.Name, service.NamespaceOrDefault(), cfgSnap.Datacenter), filterName: fmt.Sprintf("%s.%s.%s.%s", service.Name, service.NamespaceOrDefault(), service.PartitionOrDefault(), cfgSnap.Datacenter),
routeName: cluster, // Set cluster name for route config since each will have its own routeName: cluster, // Set cluster name for route config since each will have its own
cluster: cluster, cluster: cluster,
statPrefix: "upstream.", statPrefix: "upstream.",
@ -1279,12 +1279,13 @@ func (s *ResourceGenerator) makeUpstreamFilterChainForDiscoveryChain(
useRDS := true useRDS := true
var ( var (
clusterName string clusterName string
destination, datacenter, namespace string destination, datacenter, partition, namespace string
) )
// TODO (SNI partition) add partition for SNI
if chain != nil { if chain != nil {
destination, datacenter, namespace = chain.ServiceName, chain.Datacenter, chain.Namespace destination, datacenter, partition, namespace = chain.ServiceName, chain.Datacenter, chain.Partition, chain.Namespace
} }
if (chain == nil || chain.IsDefault()) && u != nil { if (chain == nil || chain.IsDefault()) && u != nil {
useRDS = false useRDS = false
@ -1298,6 +1299,9 @@ func (s *ResourceGenerator) makeUpstreamFilterChainForDiscoveryChain(
if destination == "" { if destination == "" {
destination = u.DestinationName destination = u.DestinationName
} }
if partition == "" {
partition = u.DestinationPartition
}
if namespace == "" { if namespace == "" {
namespace = u.DestinationNamespace namespace = u.DestinationNamespace
} }
@ -1328,7 +1332,12 @@ func (s *ResourceGenerator) makeUpstreamFilterChainForDiscoveryChain(
namespace = structs.IntentionDefaultNamespace namespace = structs.IntentionDefaultNamespace
} }
filterName := fmt.Sprintf("%s.%s.%s", destination, namespace, datacenter) // Default the partition to match how SNIs are generated
if partition == "" {
partition = structs.IntentionDefaultNamespace
}
filterName := fmt.Sprintf("%s.%s.%s.%s", destination, namespace, partition, datacenter)
if u != nil && u.DestinationType == structs.UpstreamDestTypePreparedQuery { if u != nil && u.DestinationType == structs.UpstreamDestTypePreparedQuery {
// Avoid encoding dc and namespace for prepared queries. // Avoid encoding dc and namespace for prepared queries.
// Those are defined in the query itself and are not available here. // Those are defined in the query itself and are not available here.
@ -1395,8 +1404,8 @@ func (s *ResourceGenerator) makeUpstreamListenerForDiscoveryChain(
useRDS := true useRDS := true
var ( var (
clusterName string clusterName string
destination, datacenter, namespace string destination, datacenter, partition, namespace string
) )
if chain == nil || chain.IsDefault() { if chain == nil || chain.IsDefault() {
useRDS = false useRDS = false
@ -1405,13 +1414,13 @@ func (s *ResourceGenerator) makeUpstreamListenerForDiscoveryChain(
if dc == "" { if dc == "" {
dc = cfgSnap.Datacenter dc = cfgSnap.Datacenter
} }
destination, datacenter, namespace = u.DestinationName, dc, u.DestinationNamespace destination, datacenter, partition, namespace = u.DestinationName, dc, u.DestinationPartition, u.DestinationNamespace
sni := connect.UpstreamSNI(u, "", dc, cfgSnap.Roots.TrustDomain) sni := connect.UpstreamSNI(u, "", dc, cfgSnap.Roots.TrustDomain)
clusterName = CustomizeClusterName(sni, chain) clusterName = CustomizeClusterName(sni, chain)
} else { } else {
destination, datacenter, namespace = chain.ServiceName, chain.Datacenter, chain.Namespace destination, datacenter, partition, namespace = chain.ServiceName, chain.Datacenter, chain.Partition, chain.Namespace
if cfg.Protocol == "tcp" { if cfg.Protocol == "tcp" {
useRDS = false useRDS = false
@ -1434,7 +1443,12 @@ func (s *ResourceGenerator) makeUpstreamListenerForDiscoveryChain(
if namespace == "" { if namespace == "" {
namespace = structs.IntentionDefaultNamespace namespace = structs.IntentionDefaultNamespace
} }
filterName := fmt.Sprintf("%s.%s.%s", destination, namespace, datacenter)
// Default the partition to match how SNIs are generated
if partition == "" {
partition = structs.IntentionDefaultNamespace
}
filterName := fmt.Sprintf("%s.%s.%s.%s", destination, namespace, partition, datacenter)
if u.DestinationType == structs.UpstreamDestTypePreparedQuery { if u.DestinationType == structs.UpstreamDestTypePreparedQuery {
// Avoid encoding dc and namespace for prepared queries. // Avoid encoding dc and namespace for prepared queries.

View File

@ -498,11 +498,9 @@ func TestListenersFromSnapshot(t *testing.T) {
snap.ConnectProxy.MeshConfigSet = true snap.ConnectProxy.MeshConfigSet = true
// DiscoveryChain without an UpstreamConfig should yield a filter chain when in transparent proxy mode // DiscoveryChain without an UpstreamConfig should yield a filter chain when in transparent proxy mode
snap.ConnectProxy.DiscoveryChain["google"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["google"] = discoverychain.TestCompileConfigEntries(t, "google", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "google", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
snap.ConnectProxy.WatchedUpstreamEndpoints["google"] = map[string]structs.CheckServiceNodes{ snap.ConnectProxy.WatchedUpstreamEndpoints["google"] = map[string]structs.CheckServiceNodes{
"google.default.dc1": { "google.default.default.dc1": {
structs.CheckServiceNode{ structs.CheckServiceNode{
Node: &structs.Node{ Node: &structs.Node{
Address: "8.8.8.8", Address: "8.8.8.8",
@ -520,7 +518,7 @@ func TestListenersFromSnapshot(t *testing.T) {
}, },
// Other targets of the discovery chain should be ignored. // Other targets of the discovery chain should be ignored.
// We only match on the upstream's virtual IP, not the IPs of other targets. // We only match on the upstream's virtual IP, not the IPs of other targets.
"google-v2.default.dc1": { "google-v2.default.default.dc1": {
structs.CheckServiceNode{ structs.CheckServiceNode{
Node: &structs.Node{ Node: &structs.Node{
Address: "7.7.7.7", Address: "7.7.7.7",
@ -537,9 +535,7 @@ func TestListenersFromSnapshot(t *testing.T) {
} }
// DiscoveryChains without endpoints do not get a filter chain because there are no addresses to match on. // DiscoveryChains without endpoints do not get a filter chain because there are no addresses to match on.
snap.ConnectProxy.DiscoveryChain["no-endpoints"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["no-endpoints"] = discoverychain.TestCompileConfigEntries(t, "no-endpoints", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "no-endpoints", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
}, },
}, },
{ {
@ -556,11 +552,9 @@ func TestListenersFromSnapshot(t *testing.T) {
} }
// DiscoveryChain without an UpstreamConfig should yield a filter chain when in transparent proxy mode // DiscoveryChain without an UpstreamConfig should yield a filter chain when in transparent proxy mode
snap.ConnectProxy.DiscoveryChain["google"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["google"] = discoverychain.TestCompileConfigEntries(t, "google", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "google", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
snap.ConnectProxy.WatchedUpstreamEndpoints["google"] = map[string]structs.CheckServiceNodes{ snap.ConnectProxy.WatchedUpstreamEndpoints["google"] = map[string]structs.CheckServiceNodes{
"google.default.dc1": { "google.default.default.dc1": {
structs.CheckServiceNode{ structs.CheckServiceNode{
Node: &structs.Node{ Node: &structs.Node{
Address: "8.8.8.8", Address: "8.8.8.8",
@ -579,9 +573,7 @@ func TestListenersFromSnapshot(t *testing.T) {
} }
// DiscoveryChains without endpoints do not get a filter chain because there are no addresses to match on. // DiscoveryChains without endpoints do not get a filter chain because there are no addresses to match on.
snap.ConnectProxy.DiscoveryChain["no-endpoints"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["no-endpoints"] = discoverychain.TestCompileConfigEntries(t, "no-endpoints", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "no-endpoints", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
}, },
}, },
{ {
@ -590,13 +582,9 @@ func TestListenersFromSnapshot(t *testing.T) {
setup: func(snap *proxycfg.ConfigSnapshot) { setup: func(snap *proxycfg.ConfigSnapshot) {
snap.Proxy.Mode = structs.ProxyModeTransparent snap.Proxy.Mode = structs.ProxyModeTransparent
snap.ConnectProxy.DiscoveryChain["mongo"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["mongo"] = discoverychain.TestCompileConfigEntries(t, "mongo", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "mongo", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
snap.ConnectProxy.DiscoveryChain["kafka"] = discoverychain.TestCompileConfigEntries( snap.ConnectProxy.DiscoveryChain["kafka"] = discoverychain.TestCompileConfigEntries(t, "kafka", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil)
t, "kafka", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil)
kafka := structs.NewServiceName("kafka", structs.DefaultEnterpriseMetaInDefaultPartition()) kafka := structs.NewServiceName("kafka", structs.DefaultEnterpriseMetaInDefaultPartition())
mongo := structs.NewServiceName("mongo", structs.DefaultEnterpriseMetaInDefaultPartition()) mongo := structs.NewServiceName("mongo", structs.DefaultEnterpriseMetaInDefaultPartition())
@ -621,7 +609,7 @@ func TestListenersFromSnapshot(t *testing.T) {
// There should still be a filter chain for mongo's virtual address // There should still be a filter chain for mongo's virtual address
snap.ConnectProxy.WatchedUpstreamEndpoints["mongo"] = map[string]structs.CheckServiceNodes{ snap.ConnectProxy.WatchedUpstreamEndpoints["mongo"] = map[string]structs.CheckServiceNodes{
"mongo.default.dc1": { "mongo.default.default.dc1": {
structs.CheckServiceNode{ structs.CheckServiceNode{
Node: &structs.Node{ Node: &structs.Node{
Datacenter: "dc1", Datacenter: "dc1",
@ -688,7 +676,8 @@ func TestListenersFromSnapshot(t *testing.T) {
gName = tt.overrideGoldenName gName = tt.overrideGoldenName
} }
require.JSONEq(t, goldenEnvoy(t, filepath.Join("listeners", gName), envoyVersion, latestEnvoyVersion, gotJSON), gotJSON) expectedJSON := goldenEnvoy(t, filepath.Join("listeners", gName), envoyVersion, latestEnvoyVersion, gotJSON)
require.JSONEq(t, expectedJSON, gotJSON)
}) })
t.Run("v2-compat", func(t *testing.T) { t.Run("v2-compat", func(t *testing.T) {

View File

@ -176,10 +176,10 @@ func TestRoutesFromSnapshot(t *testing.T) {
ConnectTimeout: 22 * time.Second, ConnectTimeout: 22 * time.Second,
}, },
} }
fooChain := discoverychain.TestCompileConfigEntries(t, "foo", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...) fooChain := discoverychain.TestCompileConfigEntries(t, "foo", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...)
barChain := discoverychain.TestCompileConfigEntries(t, "bar", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...) barChain := discoverychain.TestCompileConfigEntries(t, "bar", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...)
bazChain := discoverychain.TestCompileConfigEntries(t, "baz", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...) bazChain := discoverychain.TestCompileConfigEntries(t, "baz", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...)
quxChain := discoverychain.TestCompileConfigEntries(t, "qux", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...) quxChain := discoverychain.TestCompileConfigEntries(t, "qux", "default", "default", "dc1", connect.TestClusterID+".consul", "dc1", nil, entries...)
snap.IngressGateway.DiscoveryChain = map[string]*structs.CompiledDiscoveryChain{ snap.IngressGateway.DiscoveryChain = map[string]*structs.CompiledDiscoveryChain{
"foo": fooChain, "foo": fooChain,

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -101,7 +101,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -101,7 +101,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -78,7 +78,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -78,7 +78,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -101,7 +101,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -101,7 +101,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -78,7 +78,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -78,7 +78,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,12 +17,12 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"routeConfig": { "routeConfig": {
"name": "db", "name": "db",
"virtualHosts": [ "virtualHosts": [
{ {
"name": "db.default.dc1", "name": "db.default.default.dc1",
"domains": [ "domains": [
"*" "*"
], ],

View File

@ -17,12 +17,12 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"routeConfig": { "routeConfig": {
"name": "db", "name": "db",
"virtualHosts": [ "virtualHosts": [
{ {
"name": "db.default.dc1", "name": "db.default.default.dc1",
"domains": [ "domains": [
"*" "*"
], ],

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -42,7 +42,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -67,7 +67,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -42,7 +42,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -67,7 +67,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -194,7 +194,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -281,7 +281,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -335,7 +335,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -389,7 +389,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -443,7 +443,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -194,7 +194,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -281,7 +281,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -335,7 +335,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -389,7 +389,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -443,7 +443,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -184,7 +184,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {
@ -255,7 +255,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {
@ -326,7 +326,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -184,7 +184,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {
@ -255,7 +255,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {
@ -326,7 +326,7 @@
"name": "envoy.filters.network.http_connection_manager", "name": "envoy.filters.network.http_connection_manager",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"rds": { "rds": {
"configSource": { "configSource": {
"ads": { "ads": {

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -194,7 +194,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -32,7 +32,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.api.default.dc1", "statPrefix": "upstream.api.default.default.dc1",
"cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -86,7 +86,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.cache.default.dc1", "statPrefix": "upstream.cache.default.default.dc1",
"cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -140,7 +140,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -194,7 +194,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.web.default.dc1", "statPrefix": "upstream.web.default.default.dc1",
"cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -50,7 +50,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.google.default.dc1", "statPrefix": "upstream.google.default.default.dc1",
"cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -50,7 +50,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.google.default.dc1", "statPrefix": "upstream.google.default.default.dc1",
"cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -54,7 +54,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.mongo.default.dc1", "statPrefix": "upstream.mongo.default.default.dc1",
"cluster": "passthrough~mongo.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul" "cluster": "passthrough~mongo.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul"
} }
} }
@ -74,7 +74,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.mongo.default.dc1", "statPrefix": "upstream.mongo.default.default.dc1",
"cluster": "mongo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "mongo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -94,7 +94,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.kafka.default.dc1", "statPrefix": "upstream.kafka.default.default.dc1",
"cluster": "passthrough~kafka.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul" "cluster": "passthrough~kafka.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -54,7 +54,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.mongo.default.dc1", "statPrefix": "upstream.mongo.default.default.dc1",
"cluster": "passthrough~mongo.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul" "cluster": "passthrough~mongo.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul"
} }
} }
@ -74,7 +74,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.mongo.default.dc1", "statPrefix": "upstream.mongo.default.default.dc1",
"cluster": "mongo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "mongo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -94,7 +94,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.kafka.default.dc1", "statPrefix": "upstream.kafka.default.default.dc1",
"cluster": "passthrough~kafka.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul" "cluster": "passthrough~kafka.default.dc1.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -50,7 +50,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy", "@type": "type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy",
"statPrefix": "upstream.google.default.dc1", "statPrefix": "upstream.google.default.default.dc1",
"cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -17,7 +17,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.db.default.dc1", "statPrefix": "upstream.db.default.default.dc1",
"cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }
@ -50,7 +50,7 @@
"name": "envoy.filters.network.tcp_proxy", "name": "envoy.filters.network.tcp_proxy",
"typedConfig": { "typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "upstream.google.default.dc1", "statPrefix": "upstream.google.default.default.dc1",
"cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" "cluster": "google.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul"
} }
} }

View File

@ -1,12 +1,13 @@
package xds package xds
import ( import (
"github.com/hashicorp/consul/agent/connect"
"sort" "sort"
"sync" "sync"
"testing" "testing"
"time" "time"
"github.com/hashicorp/consul/agent/connect"
envoy_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" envoy_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
envoy_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" envoy_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
@ -591,7 +592,7 @@ func makeTestListener(t *testing.T, snap *proxycfg.ConfigSnapshot, fixtureName s
ClusterSpecifier: &envoy_tcp_proxy_v3.TcpProxy_Cluster{ ClusterSpecifier: &envoy_tcp_proxy_v3.TcpProxy_Cluster{
Cluster: "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", Cluster: "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
}, },
StatPrefix: "upstream.db.default.dc1", StatPrefix: "upstream.db.default.default.dc1",
}), }),
}, },
}, },
@ -612,7 +613,7 @@ func makeTestListener(t *testing.T, snap *proxycfg.ConfigSnapshot, fixtureName s
RouteSpecifier: &envoy_http_v3.HttpConnectionManager_RouteConfig{ RouteSpecifier: &envoy_http_v3.HttpConnectionManager_RouteConfig{
RouteConfig: makeTestRoute(t, "http2:db:inline"), RouteConfig: makeTestRoute(t, "http2:db:inline"),
}, },
StatPrefix: "upstream.db.default.dc1", StatPrefix: "upstream.db.default.default.dc1",
Tracing: &envoy_http_v3.HttpConnectionManager_Tracing{ Tracing: &envoy_http_v3.HttpConnectionManager_Tracing{
RandomSampling: &envoy_type_v3.Percent{Value: 0}, RandomSampling: &envoy_type_v3.Percent{Value: 0},
}, },
@ -640,7 +641,7 @@ func makeTestListener(t *testing.T, snap *proxycfg.ConfigSnapshot, fixtureName s
ConfigSource: xdsNewADSConfig(), ConfigSource: xdsNewADSConfig(),
}, },
}, },
StatPrefix: "upstream.db.default.dc1", StatPrefix: "upstream.db.default.default.dc1",
Tracing: &envoy_http_v3.HttpConnectionManager_Tracing{ Tracing: &envoy_http_v3.HttpConnectionManager_Tracing{
RandomSampling: &envoy_type_v3.Percent{Value: 0}, RandomSampling: &envoy_type_v3.Percent{Value: 0},
}, },
@ -668,7 +669,7 @@ func makeTestListener(t *testing.T, snap *proxycfg.ConfigSnapshot, fixtureName s
ConfigSource: xdsNewADSConfig(), ConfigSource: xdsNewADSConfig(),
}, },
}, },
StatPrefix: "upstream.db.default.dc1", StatPrefix: "upstream.db.default.default.dc1",
Tracing: &envoy_http_v3.HttpConnectionManager_Tracing{ Tracing: &envoy_http_v3.HttpConnectionManager_Tracing{
RandomSampling: &envoy_type_v3.Percent{Value: 0}, RandomSampling: &envoy_type_v3.Percent{Value: 0},
}, },
@ -736,7 +737,7 @@ func makeTestRoute(t *testing.T, fixtureName string) *envoy_route_v3.RouteConfig
Name: "db", Name: "db",
VirtualHosts: []*envoy_route_v3.VirtualHost{ VirtualHosts: []*envoy_route_v3.VirtualHost{
{ {
Name: "db.default.dc1", Name: "db.default.default.dc1",
Domains: []string{"*"}, Domains: []string{"*"},
Routes: []*envoy_route_v3.Route{ Routes: []*envoy_route_v3.Route{
{ {

View File

@ -32,21 +32,21 @@ func TestAPI_DiscoveryChain_Get(t *testing.T) {
Namespace: "default", Namespace: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*DiscoveryGraphNode{ Nodes: map[string]*DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: DiscoveryGraphNodeTypeResolver, Type: DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &DiscoveryResolver{ Resolver: &DiscoveryResolver{
Default: true, Default: true,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
}, },
}, },
}, },
Targets: map[string]*DiscoveryTarget{ Targets: map[string]*DiscoveryTarget{
"web.default.dc1": { "web.default.default.dc1": {
ID: "web.default.dc1", ID: "web.default.default.dc1",
Service: "web", Service: "web",
Namespace: "default", Namespace: "default",
Datacenter: "dc1", Datacenter: "dc1",
@ -72,21 +72,21 @@ func TestAPI_DiscoveryChain_Get(t *testing.T) {
Namespace: "default", Namespace: "default",
Datacenter: "dc2", Datacenter: "dc2",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc2", StartNode: "resolver:web.default.default.dc2",
Nodes: map[string]*DiscoveryGraphNode{ Nodes: map[string]*DiscoveryGraphNode{
"resolver:web.default.dc2": { "resolver:web.default.default.dc2": {
Type: DiscoveryGraphNodeTypeResolver, Type: DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc2", Name: "web.default.default.dc2",
Resolver: &DiscoveryResolver{ Resolver: &DiscoveryResolver{
Default: true, Default: true,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "web.default.dc2", Target: "web.default.default.dc2",
}, },
}, },
}, },
Targets: map[string]*DiscoveryTarget{ Targets: map[string]*DiscoveryTarget{
"web.default.dc2": { "web.default.default.dc2": {
ID: "web.default.dc2", ID: "web.default.default.dc2",
Service: "web", Service: "web",
Namespace: "default", Namespace: "default",
Datacenter: "dc2", Datacenter: "dc2",
@ -119,20 +119,20 @@ func TestAPI_DiscoveryChain_Get(t *testing.T) {
Namespace: "default", Namespace: "default",
Datacenter: "dc1", Datacenter: "dc1",
Protocol: "tcp", Protocol: "tcp",
StartNode: "resolver:web.default.dc1", StartNode: "resolver:web.default.default.dc1",
Nodes: map[string]*DiscoveryGraphNode{ Nodes: map[string]*DiscoveryGraphNode{
"resolver:web.default.dc1": { "resolver:web.default.default.dc1": {
Type: DiscoveryGraphNodeTypeResolver, Type: DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc1", Name: "web.default.default.dc1",
Resolver: &DiscoveryResolver{ Resolver: &DiscoveryResolver{
ConnectTimeout: 33 * time.Second, ConnectTimeout: 33 * time.Second,
Target: "web.default.dc1", Target: "web.default.default.dc1",
}, },
}, },
}, },
Targets: map[string]*DiscoveryTarget{ Targets: map[string]*DiscoveryTarget{
"web.default.dc1": { "web.default.default.dc1": {
ID: "web.default.dc1", ID: "web.default.default.dc1",
Service: "web", Service: "web",
Namespace: "default", Namespace: "default",
Datacenter: "dc1", Datacenter: "dc1",
@ -164,20 +164,20 @@ func TestAPI_DiscoveryChain_Get(t *testing.T) {
Datacenter: "dc2", Datacenter: "dc2",
Protocol: "grpc", Protocol: "grpc",
CustomizationHash: "98809527", CustomizationHash: "98809527",
StartNode: "resolver:web.default.dc2", StartNode: "resolver:web.default.default.dc2",
Nodes: map[string]*DiscoveryGraphNode{ Nodes: map[string]*DiscoveryGraphNode{
"resolver:web.default.dc2": { "resolver:web.default.default.dc2": {
Type: DiscoveryGraphNodeTypeResolver, Type: DiscoveryGraphNodeTypeResolver,
Name: "web.default.dc2", Name: "web.default.default.dc2",
Resolver: &DiscoveryResolver{ Resolver: &DiscoveryResolver{
ConnectTimeout: 22 * time.Second, ConnectTimeout: 22 * time.Second,
Target: "web.default.dc2", Target: "web.default.default.dc2",
}, },
}, },
}, },
Targets: map[string]*DiscoveryTarget{ Targets: map[string]*DiscoveryTarget{
"web.default.dc2": { "web.default.default.dc2": {
ID: "web.default.dc2", ID: "web.default.default.dc2",
Service: "web", Service: "web",
Namespace: "default", Namespace: "default",
Datacenter: "dc2", Datacenter: "dc2",