Update xds/proxycfg tests to use the same looking trust domain as a normal system

This is to prevent confusion about what our SNI fields actually look like.
pull/6053/head
Matt Keeler 2019-07-02 10:29:09 -04:00
parent a7421c160f
commit a8e2e866e3
13 changed files with 89 additions and 88 deletions

View File

@ -2,6 +2,7 @@ package proxycfg
import ( import (
"context" "context"
"fmt"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
@ -85,7 +86,7 @@ func TestCerts(t testing.T) (*structs.IndexedCARoots, *structs.IssuedCert) {
ca := connect.TestCA(t, nil) ca := connect.TestCA(t, nil)
roots := &structs.IndexedCARoots{ roots := &structs.IndexedCARoots{
ActiveRootID: ca.ID, ActiveRootID: ca.ID,
TrustDomain: connect.TestClusterID, TrustDomain: fmt.Sprintf("%s.consul", connect.TestClusterID),
Roots: []*structs.CARoot{ca}, Roots: []*structs.CARoot{ca},
} }
return roots, TestLeafForCA(t, ca) return roots, TestLeafForCA(t, ca)

View File

@ -212,7 +212,7 @@ func expectClustersJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot, to
}, },
"connectTimeout": "1s", "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": ` "prepared_query:geo-cache": `
{ {
@ -230,7 +230,7 @@ func expectClustersJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot, to
}, },
"connectTimeout": "5s", "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") + `
}`, }`,
} }
} }

View File

@ -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": { "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": { "outlierDetection": {

View File

@ -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": { "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": { "outlierDetection": {

View File

@ -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": { "outlierDetection": {

View File

@ -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": { "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": { "outlierDetection": {

View File

@ -3,7 +3,7 @@
"resources": [ "resources": [
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {
@ -19,7 +19,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {
@ -35,7 +35,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {
@ -51,7 +51,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {
@ -67,7 +67,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {

View File

@ -3,7 +3,7 @@
"resources": [ "resources": [
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {
@ -19,7 +19,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {
@ -35,7 +35,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.Cluster", "@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", "type": "EDS",
"edsClusterConfig": { "edsClusterConfig": {
"edsConfig": { "edsConfig": {

View File

@ -3,7 +3,7 @@
"resources": [ "resources": [
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -37,53 +37,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment",
"clusterName": "bar.default.dc1.internal.11111111-2222-3333-4444-555555555555", "clusterName": "foo.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": "foo.default.dc1.internal.11111111-2222-3333-4444-555555555555",
"endpoints": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -141,7 +95,53 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -175,7 +175,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -197,7 +197,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -231,7 +231,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [

View File

@ -3,7 +3,7 @@
"resources": [ "resources": [
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -37,7 +37,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [
@ -95,7 +95,7 @@
}, },
{ {
"@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", "@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": [ "endpoints": [
{ {
"lbEndpoints": [ "lbEndpoints": [

View File

@ -14,14 +14,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_bar_dc2_tcp"
} }
} }
@ -61,14 +61,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_baz_dc2_tcp"
} }
} }
@ -108,14 +108,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_default_dc2_tcp"
} }
} }
@ -155,14 +155,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_foo_dc2_tcp"
} }
} }

View File

@ -14,14 +14,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_lan_dc2_tcp"
} }
} }
@ -61,14 +61,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_wan_dc2_tcp"
} }
} }

View File

@ -14,14 +14,14 @@
{ {
"filterChainMatch": { "filterChainMatch": {
"serverNames": [ "serverNames": [
"*.dc2.internal.11111111-2222-3333-4444-555555555555" "*.dc2.internal.11111111-2222-3333-4444-555555555555.consul"
] ]
}, },
"filters": [ "filters": [
{ {
"name": "envoy.tcp_proxy", "name": "envoy.tcp_proxy",
"config": { "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" "stat_prefix": "mesh_gateway_remote_default_dc2_tcp"
} }
} }