diff --git a/agent/proxycfg/testing.go b/agent/proxycfg/testing.go index 640abdb57c..3fbc91b13e 100644 --- a/agent/proxycfg/testing.go +++ b/agent/proxycfg/testing.go @@ -2,6 +2,7 @@ package proxycfg import ( "context" + "fmt" "sync" "sync/atomic" "time" @@ -85,7 +86,7 @@ func TestCerts(t testing.T) (*structs.IndexedCARoots, *structs.IssuedCert) { ca := connect.TestCA(t, nil) roots := &structs.IndexedCARoots{ ActiveRootID: ca.ID, - TrustDomain: connect.TestClusterID, + TrustDomain: fmt.Sprintf("%s.consul", connect.TestClusterID), Roots: []*structs.CARoot{ca}, } return roots, TestLeafForCA(t, ca) diff --git a/agent/xds/clusters_test.go b/agent/xds/clusters_test.go index cd17c92644..8ca9ec9dc3 100644 --- a/agent/xds/clusters_test.go +++ b/agent/xds/clusters_test.go @@ -212,7 +212,7 @@ func expectClustersJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot, to }, "connectTimeout": "1s", - "tlsContext": ` + expectedUpstreamTLSContextJSON(t, snap, "db.default.dc1.internal.11111111-2222-3333-4444-555555555555") + ` + "tlsContext": ` + expectedUpstreamTLSContextJSON(t, snap, "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul") + ` }`, "prepared_query:geo-cache": ` { @@ -230,7 +230,7 @@ func expectClustersJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot, to }, "connectTimeout": "5s", - "tlsContext": ` + expectedUpstreamTLSContextJSON(t, snap, "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555") + ` + "tlsContext": ` + expectedUpstreamTLSContextJSON(t, snap, "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul") + ` }`, } } diff --git a/agent/xds/testdata/clusters/custom-local-app.golden b/agent/xds/testdata/clusters/custom-local-app.golden index 79a2210be4..5266b1fc13 100644 --- a/agent/xds/testdata/clusters/custom-local-app.golden +++ b/agent/xds/testdata/clusters/custom-local-app.golden @@ -47,7 +47,7 @@ } } }, - "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { @@ -86,7 +86,7 @@ } } }, - "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { diff --git a/agent/xds/testdata/clusters/custom-timeouts.golden b/agent/xds/testdata/clusters/custom-timeouts.golden index a5688aa4e4..f1846f8eb9 100644 --- a/agent/xds/testdata/clusters/custom-timeouts.golden +++ b/agent/xds/testdata/clusters/custom-timeouts.golden @@ -59,7 +59,7 @@ } } }, - "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { @@ -98,7 +98,7 @@ } } }, - "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { diff --git a/agent/xds/testdata/clusters/custom-upstream.golden b/agent/xds/testdata/clusters/custom-upstream.golden index 3b9527ddf8..ffc14d89b5 100644 --- a/agent/xds/testdata/clusters/custom-upstream.golden +++ b/agent/xds/testdata/clusters/custom-upstream.golden @@ -59,7 +59,7 @@ } } }, - "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" } }, { @@ -95,7 +95,7 @@ } } }, - "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { diff --git a/agent/xds/testdata/clusters/defaults.golden b/agent/xds/testdata/clusters/defaults.golden index 25a9af804a..f1f404456f 100644 --- a/agent/xds/testdata/clusters/defaults.golden +++ b/agent/xds/testdata/clusters/defaults.golden @@ -59,7 +59,7 @@ } } }, - "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { @@ -98,7 +98,7 @@ } } }, - "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555" + "sni": "geo-cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, "outlierDetection": { diff --git a/agent/xds/testdata/clusters/mesh-gateway-service-subsets.golden b/agent/xds/testdata/clusters/mesh-gateway-service-subsets.golden index f2ee7a0abd..2a01dc2509 100644 --- a/agent/xds/testdata/clusters/mesh-gateway-service-subsets.golden +++ b/agent/xds/testdata/clusters/mesh-gateway-service-subsets.golden @@ -3,7 +3,7 @@ "resources": [ { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "dc2.internal.11111111-2222-3333-4444-555555555555", + "name": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { @@ -19,7 +19,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "name": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { @@ -35,7 +35,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "name": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { @@ -51,7 +51,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "v1.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "name": "v1.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { @@ -67,7 +67,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "v2.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "name": "v2.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { diff --git a/agent/xds/testdata/clusters/mesh-gateway.golden b/agent/xds/testdata/clusters/mesh-gateway.golden index b515718721..7c8ef1f42b 100644 --- a/agent/xds/testdata/clusters/mesh-gateway.golden +++ b/agent/xds/testdata/clusters/mesh-gateway.golden @@ -3,7 +3,7 @@ "resources": [ { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "dc2.internal.11111111-2222-3333-4444-555555555555", + "name": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { @@ -19,7 +19,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "name": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { @@ -35,7 +35,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.Cluster", - "name": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "name": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "type": "EDS", "edsClusterConfig": { "edsConfig": { diff --git a/agent/xds/testdata/endpoints/mesh-gateway-service-subsets.golden b/agent/xds/testdata/endpoints/mesh-gateway-service-subsets.golden index b302d8daef..87ac0b806a 100644 --- a/agent/xds/testdata/endpoints/mesh-gateway-service-subsets.golden +++ b/agent/xds/testdata/endpoints/mesh-gateway-service-subsets.golden @@ -3,7 +3,7 @@ "resources": [ { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "dc2.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -37,53 +37,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", - "endpoints": [ - { - "lbEndpoints": [ - { - "endpoint": { - "address": { - "socketAddress": { - "address": "172.16.1.6", - "portValue": 2222 - } - } - }, - "healthStatus": "HEALTHY", - "loadBalancingWeight": 1 - }, - { - "endpoint": { - "address": { - "socketAddress": { - "address": "172.16.1.7", - "portValue": 2222 - } - } - }, - "healthStatus": "HEALTHY", - "loadBalancingWeight": 1 - }, - { - "endpoint": { - "address": { - "socketAddress": { - "address": "172.16.1.8", - "portValue": 2222 - } - } - }, - "healthStatus": "HEALTHY", - "loadBalancingWeight": 1 - } - ] - } - ] - }, - { - "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -141,7 +95,53 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "v1.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "endpoints": [ + { + "lbEndpoints": [ + { + "endpoint": { + "address": { + "socketAddress": { + "address": "172.16.1.6", + "portValue": 2222 + } + } + }, + "healthStatus": "HEALTHY", + "loadBalancingWeight": 1 + }, + { + "endpoint": { + "address": { + "socketAddress": { + "address": "172.16.1.7", + "portValue": 2222 + } + } + }, + "healthStatus": "HEALTHY", + "loadBalancingWeight": 1 + }, + { + "endpoint": { + "address": { + "socketAddress": { + "address": "172.16.1.8", + "portValue": 2222 + } + } + }, + "healthStatus": "HEALTHY", + "loadBalancingWeight": 1 + } + ] + } + ] + }, + { + "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", + "clusterName": "v1.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -175,7 +175,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "v2.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "v2.bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -197,7 +197,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "v1.foo.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "v1.foo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -231,7 +231,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "v2.foo.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "v2.foo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ diff --git a/agent/xds/testdata/endpoints/mesh-gateway.golden b/agent/xds/testdata/endpoints/mesh-gateway.golden index 4390ac9ab9..ad013f1df0 100644 --- a/agent/xds/testdata/endpoints/mesh-gateway.golden +++ b/agent/xds/testdata/endpoints/mesh-gateway.golden @@ -3,7 +3,7 @@ "resources": [ { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "dc2.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -37,7 +37,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ @@ -95,7 +95,7 @@ }, { "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", - "clusterName": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", + "clusterName": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "endpoints": [ { "lbEndpoints": [ diff --git a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.golden b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.golden index 33bafcd9a9..0ef43158bc 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.golden @@ -14,14 +14,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_bar_dc2_tcp" } } @@ -61,14 +61,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_baz_dc2_tcp" } } @@ -108,14 +108,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" } } @@ -155,14 +155,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_foo_dc2_tcp" } } diff --git a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.golden b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.golden index ed0e11aee8..7ee0199667 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.golden @@ -14,14 +14,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_lan_dc2_tcp" } } @@ -61,14 +61,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_wan_dc2_tcp" } } diff --git a/agent/xds/testdata/listeners/mesh-gateway.golden b/agent/xds/testdata/listeners/mesh-gateway.golden index 6f95010b33..85b6ad1f4c 100644 --- a/agent/xds/testdata/listeners/mesh-gateway.golden +++ b/agent/xds/testdata/listeners/mesh-gateway.golden @@ -14,14 +14,14 @@ { "filterChainMatch": { "serverNames": [ - "*.dc2.internal.11111111-2222-3333-4444-555555555555" + "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul" ] }, "filters": [ { "name": "envoy.tcp_proxy", "config": { - "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555", + "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" } }