diff --git a/agent/proxycfg/testing_api_gateway.go b/agent/proxycfg/testing_api_gateway.go index 87ff58fbf05..f42875af8cc 100644 --- a/agent/proxycfg/testing_api_gateway.go +++ b/agent/proxycfg/testing_api_gateway.go @@ -8,10 +8,9 @@ import ( "github.com/mitchellh/go-testing-interface" + "github.com/hashicorp/consul/agent/configentry" "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/agent/consul/discoverychain" - - "github.com/hashicorp/consul/agent/configentry" "github.com/hashicorp/consul/agent/structs" ) diff --git a/agent/proxycfg/testing_mesh_gateway.go b/agent/proxycfg/testing_mesh_gateway.go index c414a09caf7..d6622699d0e 100644 --- a/agent/proxycfg/testing_mesh_gateway.go +++ b/agent/proxycfg/testing_mesh_gateway.go @@ -747,6 +747,73 @@ func TestConfigSnapshotPeeredMeshGateway(t testing.T, variant string, nsFn func( }, }, ) + case "mgw-peered-upstream": + // This is a modified version of "chain-and-l7-stuff" that adds a peer field to the resolver + // and removes some of the extraneous disco-chain testing. + entries = []structs.ConfigEntry{ + &structs.ProxyConfigEntry{ + Kind: structs.ProxyDefaults, + Name: structs.ProxyConfigGlobal, + Config: map[string]interface{}{ + "protocol": "http", + }, + }, + &structs.ServiceResolverConfigEntry{ + Kind: structs.ServiceResolver, + Name: "db", + Redirect: &structs.ServiceResolverRedirect{ + Service: "alt", + Peer: "peer-b", + }, + ConnectTimeout: 33 * time.Second, + RequestTimeout: 33 * time.Second, + }, + } + for _, entry := range entries { + require.NoError(t, entry.Normalize()) + require.NoError(t, entry.Validate()) + } + + set := configentry.NewDiscoveryChainSet() + set.AddEntries(entries...) + + var ( + dbSN = structs.NewServiceName("db", nil) + altSN = structs.NewServiceName("alt", nil) + + dbChain = discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", connect.TestClusterID+".consul", nil, set) + ) + + needPeerA = true + needLeaf = true + discoChains[dbSN] = dbChain + endpoints[dbSN] = TestUpstreamNodes(t, "db") + endpoints[altSN] = TestUpstreamNodes(t, "alt") + + extraUpdates = append(extraUpdates, + UpdateEvent{ + CorrelationID: datacentersWatchID, + Result: &[]string{"dc1"}, + }, + UpdateEvent{ + CorrelationID: exportedServiceListWatchID, + Result: &structs.IndexedExportedServiceList{ + Services: map[string]structs.ServiceList{ + "peer-a": []structs.ServiceName{dbSN}, + }, + }, + }, + UpdateEvent{ + CorrelationID: serviceListWatchID, + Result: &structs.IndexedServiceList{ + Services: []structs.ServiceName{ + dbSN, + altSN, + }, + }, + }, + ) + case "chain-and-l7-stuff": entries = []structs.ConfigEntry{ &structs.ProxyConfigEntry{ diff --git a/agent/proxycfg/testing_terminating_gateway.go b/agent/proxycfg/testing_terminating_gateway.go index 2bfdd8fca04..731c8e54b2d 100644 --- a/agent/proxycfg/testing_terminating_gateway.go +++ b/agent/proxycfg/testing_terminating_gateway.go @@ -4,6 +4,8 @@ package proxycfg import ( + "time" + "github.com/mitchellh/go-testing-interface" "github.com/hashicorp/consul/agent/structs" @@ -648,6 +650,7 @@ func testConfigSnapshotTerminatingGatewayLBConfig(t testing.T, variant string) * OnlyPassing: true, }, }, + RequestTimeout: 200 * time.Millisecond, LoadBalancer: &structs.LoadBalancer{ Policy: "ring_hash", RingHashConfig: &structs.RingHashConfig{ diff --git a/agent/proxycfg/testing_upstreams.go b/agent/proxycfg/testing_upstreams.go index f9b77c4d62d..c5c47ae72fe 100644 --- a/agent/proxycfg/testing_upstreams.go +++ b/agent/proxycfg/testing_upstreams.go @@ -256,6 +256,9 @@ func setupTestVariationConfigEntriesAndSnapshot( case "chain-and-router": case "lb-resolver": case "register-to-terminating-gateway": + case "redirect-to-lb-node": + case "resolver-with-lb": + case "splitter-overweight": default: extraEvents := extraUpdateEvents(t, variation, dbUID) events = append(events, extraEvents...) @@ -580,6 +583,61 @@ func setupTestVariationDiscoveryChain( }, }, ) + case "splitter-overweight": + entries = append(entries, + &structs.ServiceResolverConfigEntry{ + Kind: structs.ServiceResolver, + Name: "db", + EnterpriseMeta: entMeta, + ConnectTimeout: 33 * time.Second, + RequestTimeout: 33 * time.Second, + }, + &structs.ProxyConfigEntry{ + Kind: structs.ProxyDefaults, + Name: structs.ProxyConfigGlobal, + EnterpriseMeta: entMeta, + Config: map[string]interface{}{ + "protocol": "http", + }, + }, + &structs.ServiceSplitterConfigEntry{ + Kind: structs.ServiceSplitter, + Name: "db", + EnterpriseMeta: entMeta, + Splits: []structs.ServiceSplit{ + { + Weight: 100.0, + Service: "big-side", + RequestHeaders: &structs.HTTPHeaderModifiers{ + Set: map[string]string{"x-split-leg": "big"}, + }, + ResponseHeaders: &structs.HTTPHeaderModifiers{ + Set: map[string]string{"x-split-leg": "big"}, + }, + }, + { + Weight: 100.0, + Service: "goldilocks-side", + RequestHeaders: &structs.HTTPHeaderModifiers{ + Set: map[string]string{"x-split-leg": "goldilocks"}, + }, + ResponseHeaders: &structs.HTTPHeaderModifiers{ + Set: map[string]string{"x-split-leg": "goldilocks"}, + }, + }, + { + Weight: 100.0, + Service: "lil-bit-side", + RequestHeaders: &structs.HTTPHeaderModifiers{ + Set: map[string]string{"x-split-leg": "small"}, + }, + ResponseHeaders: &structs.HTTPHeaderModifiers{ + Set: map[string]string{"x-split-leg": "small"}, + }, + }, + }, + }, + ) case "grpc-router": entries = append(entries, &structs.ServiceResolverConfigEntry{ @@ -917,12 +975,74 @@ func setupTestVariationDiscoveryChain( Field: "header", FieldValue: "x-user-id", }, + { + Field: "query_parameter", + FieldValue: "my-pretty-param", + }, { SourceIP: true, Terminal: true, }, }, }, + }) + case "redirect-to-lb-node": + entries = append(entries, + &structs.ProxyConfigEntry{ + Kind: structs.ProxyDefaults, + Name: structs.ProxyConfigGlobal, + EnterpriseMeta: entMeta, + Config: map[string]interface{}{ + "protocol": "http", + }, + }, + &structs.ServiceRouterConfigEntry{ + Kind: structs.ServiceRouter, + Name: "db", + EnterpriseMeta: entMeta, + Routes: []structs.ServiceRoute{ + { + Match: httpMatch(&structs.ServiceRouteHTTPMatch{ + PathPrefix: "/web", + }), + Destination: toService("web"), + }, + }, + }, + &structs.ServiceResolverConfigEntry{ + Kind: structs.ServiceResolver, + Name: "web", + EnterpriseMeta: entMeta, + LoadBalancer: &structs.LoadBalancer{ + Policy: "ring_hash", + RingHashConfig: &structs.RingHashConfig{ + MinimumRingSize: 20, + MaximumRingSize: 30, + }, + }, + }, + ) + case "resolver-with-lb": + entries = append(entries, + &structs.ProxyConfigEntry{ + Kind: structs.ProxyDefaults, + Name: structs.ProxyConfigGlobal, + EnterpriseMeta: entMeta, + Config: map[string]interface{}{ + "protocol": "http", + }, + }, + &structs.ServiceResolverConfigEntry{ + Kind: structs.ServiceResolver, + Name: "db", + EnterpriseMeta: entMeta, + LoadBalancer: &structs.LoadBalancer{ + Policy: "ring_hash", + RingHashConfig: &structs.RingHashConfig{ + MinimumRingSize: 20, + MaximumRingSize: 30, + }, + }, }, ) default: diff --git a/agent/xds/clusters.go b/agent/xds/clusters.go index d4016eabb2b..bcce1d01abb 100644 --- a/agent/xds/clusters.go +++ b/agent/xds/clusters.go @@ -971,8 +971,10 @@ func (s *ResourceGenerator) clustersFromSnapshotAPIGateway(cfgSnap *proxycfg.Con // Grab the discovery chain compiled in handlerAPIGateway.recompileDiscoveryChains chain, ok := cfgSnap.APIGateway.DiscoveryChain[uid] if !ok { - // this should not happen - return nil, fmt.Errorf("no discovery chain for upstream %q", uid) + // this should not happen, but it can't error out because the equivalent + // listener generation will continue + s.Logger.Warn("could not find discovery chain for gateway upstream", "upstream", uid) + continue } // Generate the list of upstream clusters for the discovery chain @@ -2027,6 +2029,7 @@ func (s *ResourceGenerator) getTargetClusterName(upstreamsSnapshot *proxycfg.Con target := chain.Targets[tid] clusterName := target.Name targetUID := proxycfg.NewUpstreamIDFromTargetID(tid) + if targetUID.Peer != "" { tbs, ok := upstreamsSnapshot.UpstreamPeerTrustBundles.Get(targetUID.Peer) // We can't generate cluster on peers without the trust bundle. The diff --git a/agent/xds/resources_test.go b/agent/xds/resources_test.go index 87ccf5e4788..47573f3173f 100644 --- a/agent/xds/resources_test.go +++ b/agent/xds/resources_test.go @@ -157,8 +157,10 @@ func TestAllResourcesFromSnapshot(t *testing.T) { }, }, { - name: "transparent-proxy", - create: proxycfg.TestConfigSnapshotTransparentProxy, + name: "transparent-proxy", + create: func(t testinf.T) *proxycfg.ConfigSnapshot { + return proxycfg.TestConfigSnapshotTransparentProxy(t) + }, }, { name: "connect-proxy-with-peered-upstreams", diff --git a/agent/xds/routes.go b/agent/xds/routes.go index 7ecfc5255b1..e02e845bd92 100644 --- a/agent/xds/routes.go +++ b/agent/xds/routes.go @@ -14,9 +14,9 @@ import ( envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" envoy_matcher_v3 "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" - "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/wrapperspb" "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/agent/consul/discoverychain" @@ -56,17 +56,13 @@ func (s *ResourceGenerator) routesForConnectProxy(cfgSnap *proxycfg.ConfigSnapsh continue } - explicit := cfgSnap.ConnectProxy.UpstreamConfig[uid].HasLocalPortOrSocket() - implicit := cfgSnap.ConnectProxy.IsImplicitUpstream(uid) - if !implicit && !explicit { - // Discovery chain is not associated with a known explicit or implicit upstream so it is skipped. - continue - } - virtualHost, err := s.makeUpstreamRouteForDiscoveryChain(cfgSnap, uid, chain, []string{"*"}, false) if err != nil { return nil, err } + if virtualHost == nil { + continue + } route := &envoy_route_v3.RouteConfiguration{ Name: uid.EnvoyID(), @@ -249,10 +245,6 @@ func (s *ResourceGenerator) routesForMeshGateway(cfgSnap *proxycfg.ConfigSnapsho continue // ignore; not relevant } - if cfgSnap.MeshGateway.Leaf == nil { - continue // ignore; not ready - } - uid := proxycfg.NewUpstreamIDFromServiceName(svc) virtualHost, err := s.makeUpstreamRouteForDiscoveryChain( @@ -265,6 +257,9 @@ func (s *ResourceGenerator) routesForMeshGateway(cfgSnap *proxycfg.ConfigSnapsho if err != nil { return nil, err } + if virtualHost == nil { + continue + } route := &envoy_route_v3.RouteConfiguration{ Name: uid.EnvoyID(), @@ -374,6 +369,9 @@ func (s *ResourceGenerator) routesForIngressGateway(cfgSnap *proxycfg.ConfigSnap uid := proxycfg.NewUpstreamID(&u) chain := cfgSnap.IngressGateway.DiscoveryChain[uid] if chain == nil { + // Note that if we continue here we must also do this in the cluster generation + s.Logger.Warn("could not find discovery chain for ingress upstream", + "listener", listenerKey, "upstream", uid) continue } @@ -382,6 +380,9 @@ func (s *ResourceGenerator) routesForIngressGateway(cfgSnap *proxycfg.ConfigSnap if err != nil { return nil, err } + if virtualHost == nil { + continue + } // Lookup listener and service config details from ingress gateway // definition. @@ -466,6 +467,7 @@ func (s *ResourceGenerator) routesForAPIGateway(cfgSnap *proxycfg.ConfigSnapshot uid := proxycfg.NewUpstreamID(&upstream) chain := cfgSnap.APIGateway.DiscoveryChain[uid] if chain == nil { + // Note that if we continue here we must also do this in the cluster generation s.Logger.Debug("Discovery chain not found for flattened route", "discovery chain ID", uid) continue } @@ -476,6 +478,9 @@ func (s *ResourceGenerator) routesForAPIGateway(cfgSnap *proxycfg.ConfigSnapshot if err != nil { return nil, err } + if virtualHost == nil { + continue + } defaultRoute.VirtualHosts = append(defaultRoute.VirtualHosts, virtualHost) } @@ -975,19 +980,18 @@ func (s *ResourceGenerator) makeRouteActionForSplitter( return nil, fmt.Errorf("number of clusters in splitter must be > 0; got %d", len(clusters)) } - envoyWeightScale := 10000 - if envoyWeightScale < totalWeight { - clusters[0].Weight.Value += uint32(totalWeight - envoyWeightScale) - } else { - clusters[0].Weight.Value += uint32(envoyWeightScale - totalWeight) + var envoyWeightScale *wrapperspb.UInt32Value + if totalWeight == 10000 { + envoyWeightScale = makeUint32Value(10000) } return &envoy_route_v3.Route_Route{ Route: &envoy_route_v3.RouteAction{ ClusterSpecifier: &envoy_route_v3.RouteAction_WeightedClusters{ WeightedClusters: &envoy_route_v3.WeightedCluster{ - Clusters: clusters, - TotalWeight: makeUint32Value(envoyWeightScale), // scaled up 100% + Clusters: clusters, + // this field is deprecated, and we should get the desired behavior with the front-end validation + TotalWeight: envoyWeightScale, // scaled up 100% }, }, }, diff --git a/agent/xds/routes_test.go b/agent/xds/routes_test.go index eaa8d48c0fc..9496eca4b6d 100644 --- a/agent/xds/routes_test.go +++ b/agent/xds/routes_test.go @@ -10,14 +10,13 @@ import ( "time" envoy_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - "github.com/hashicorp/consul/agent/xds/testcommon" - testinf "github.com/mitchellh/go-testing-interface" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/durationpb" "github.com/hashicorp/consul/agent/proxycfg" "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/consul/agent/xds/testcommon" "github.com/hashicorp/consul/envoyextensions/xdscommon" "github.com/hashicorp/consul/sdk/testutil" ) @@ -42,6 +41,12 @@ func makeRouteDiscoChainTests(enterprise bool) []routeTestCase { return proxycfg.TestConfigSnapshotDiscoveryChain(t, "external-sni", enterprise, nil, nil) }, }, + { + name: "connect-proxy-splitter-overweight", + create: func(t testinf.T) *proxycfg.ConfigSnapshot { + return proxycfg.TestConfigSnapshotDiscoveryChain(t, "splitter-overweight", enterprise, nil, nil) + }, + }, { name: "connect-proxy-with-chain-and-overrides", create: func(t testinf.T) *proxycfg.ConfigSnapshot { @@ -78,6 +83,18 @@ func makeRouteDiscoChainTests(enterprise bool) []routeTestCase { return proxycfg.TestConfigSnapshotDiscoveryChain(t, "lb-resolver", enterprise, nil, nil) }, }, + { + name: "connect-proxy-route-to-lb-resolver", + create: func(t testinf.T) *proxycfg.ConfigSnapshot { + return proxycfg.TestConfigSnapshotDiscoveryChain(t, "redirect-to-lb-node", enterprise, nil, nil) + }, + }, + { + name: "connect-proxy-resolver-with-lb", + create: func(t testinf.T) *proxycfg.ConfigSnapshot { + return proxycfg.TestConfigSnapshotDiscoveryChain(t, "resolver-with-lb", enterprise, nil, nil) + }, + }, } } @@ -443,6 +460,11 @@ func TestEnvoyLBConfig_InjectToRouteAction(t *testing.T) { FieldValue: "special-header", Terminal: true, }, + { + Field: structs.HashPolicyQueryParam, + FieldValue: "my-pretty-param", + Terminal: true, + }, }, }, expected: &envoy_route_v3.RouteAction{ @@ -481,6 +503,14 @@ func TestEnvoyLBConfig_InjectToRouteAction(t *testing.T) { }, Terminal: true, }, + { + PolicySpecifier: &envoy_route_v3.RouteAction_HashPolicy_QueryParameter_{ + QueryParameter: &envoy_route_v3.RouteAction_HashPolicy_QueryParameter{ + Name: "my-pretty-param", + }, + }, + Terminal: true, + }, }, }, }, diff --git a/agent/xds/testdata/clusters/connect-proxy-with-chain-and-overrides.latest.golden b/agent/xds/testdata/clusters/connect-proxy-with-chain-and-overrides.latest.golden index fd63324de86..a6334a035a7 100644 --- a/agent/xds/testdata/clusters/connect-proxy-with-chain-and-overrides.latest.golden +++ b/agent/xds/testdata/clusters/connect-proxy-with-chain-and-overrides.latest.golden @@ -8,42 +8,30 @@ "type": "EDS", "edsClusterConfig": { "edsConfig": { - "ads": { - - }, + "ads": {}, "resourceApiVersion": "V3" } }, "connectTimeout": "66s", - "circuitBreakers": { - - }, + "circuitBreakers": {}, "typedExtensionProtocolOptions": { "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": { "@type": "type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions", "explicitHttpConfig": { - "http2ProtocolOptions": { - - } + "http2ProtocolOptions": {} } } }, - "outlierDetection": { - - }, + "outlierDetection": {}, "commonLbConfig": { - "healthyPanicThreshold": { - - } + "healthyPanicThreshold": {} }, "transportSocket": { "name": "tls", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext", "commonTlsContext": { - "tlsParams": { - - }, + "tlsParams": {}, "tlsCertificates": [ { "certificateChain": { @@ -75,27 +63,19 @@ "type": "EDS", "edsClusterConfig": { "edsConfig": { - "ads": { - - }, + "ads": {}, "resourceApiVersion": "V3" } }, "connectTimeout": "5s", - "circuitBreakers": { - - }, - "outlierDetection": { - - }, + "circuitBreakers": {}, + "outlierDetection": {}, "transportSocket": { "name": "tls", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext", "commonTlsContext": { - "tlsParams": { - - }, + "tlsParams": {}, "tlsCertificates": [ { "certificateChain": { diff --git a/agent/xds/testdata/clusters/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden b/agent/xds/testdata/clusters/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden index c8ca9b37688..36b196675ca 100644 --- a/agent/xds/testdata/clusters/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden +++ b/agent/xds/testdata/clusters/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden @@ -213,4 +213,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.cluster.v3.Cluster", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.latest.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.latest.golden index 03e15abeaa7..1fc03f74705 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.latest.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.latest.golden @@ -148,4 +148,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.listener.v3.Listener", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden b/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden index 9cac4804025..75fe8ccc350 100644 --- a/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden +++ b/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden @@ -47,6 +47,11 @@ "headerName": "x-user-id" } }, + { + "queryParameter": { + "name": "my-pretty-param" + } + }, { "connectionProperties": { "sourceIp": true diff --git a/agent/xds/testdata/routes/connect-proxy-resolver-with-lb.latest.golden b/agent/xds/testdata/routes/connect-proxy-resolver-with-lb.latest.golden new file mode 100644 index 00000000000..547b923b0d6 --- /dev/null +++ b/agent/xds/testdata/routes/connect-proxy-resolver-with-lb.latest.golden @@ -0,0 +1,30 @@ +{ + "versionInfo": "00000001", + "resources": [ + { + "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "name": "db", + "virtualHosts": [ + { + "name": "db", + "domains": [ + "*" + ], + "routes": [ + { + "match": { + "prefix": "/" + }, + "route": { + "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" + } + } + ] + } + ], + "validateClusters": true + } + ], + "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "nonce": "00000001" +} \ No newline at end of file diff --git a/agent/xds/testdata/routes/connect-proxy-route-to-lb-resolver.latest.golden b/agent/xds/testdata/routes/connect-proxy-route-to-lb-resolver.latest.golden new file mode 100644 index 00000000000..b364c9f9d0c --- /dev/null +++ b/agent/xds/testdata/routes/connect-proxy-route-to-lb-resolver.latest.golden @@ -0,0 +1,38 @@ +{ + "versionInfo": "00000001", + "resources": [ + { + "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "name": "db", + "virtualHosts": [ + { + "name": "db", + "domains": [ + "*" + ], + "routes": [ + { + "match": { + "prefix": "/web" + }, + "route": { + "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" + } + }, + { + "match": { + "prefix": "/" + }, + "route": { + "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" + } + } + ] + } + ], + "validateClusters": true + } + ], + "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "nonce": "00000001" +} \ No newline at end of file diff --git a/agent/xds/testdata/routes/connect-proxy-splitter-overweight.latest.golden b/agent/xds/testdata/routes/connect-proxy-splitter-overweight.latest.golden new file mode 100644 index 00000000000..776509501f6 --- /dev/null +++ b/agent/xds/testdata/routes/connect-proxy-splitter-overweight.latest.golden @@ -0,0 +1,99 @@ +{ + "versionInfo": "00000001", + "resources": [ + { + "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "name": "db", + "virtualHosts": [ + { + "name": "db", + "domains": [ + "*" + ], + "routes": [ + { + "match": { + "prefix": "/" + }, + "route": { + "weightedClusters": { + "clusters": [ + { + "name": "big-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "weight": 10000, + "requestHeadersToAdd": [ + { + "header": { + "key": "x-split-leg", + "value": "big" + }, + "append": false + } + ], + "responseHeadersToAdd": [ + { + "header": { + "key": "x-split-leg", + "value": "big" + }, + "append": false + } + ] + }, + { + "name": "goldilocks-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "weight": 10000, + "requestHeadersToAdd": [ + { + "header": { + "key": "x-split-leg", + "value": "goldilocks" + }, + "append": false + } + ], + "responseHeadersToAdd": [ + { + "header": { + "key": "x-split-leg", + "value": "goldilocks" + }, + "append": false + } + ] + }, + { + "name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "weight": 10000, + "requestHeadersToAdd": [ + { + "header": { + "key": "x-split-leg", + "value": "small" + }, + "append": false + } + ], + "responseHeadersToAdd": [ + { + "header": { + "key": "x-split-leg", + "value": "small" + }, + "append": false + } + ] + } + ] + } + } + } + ] + } + ], + "validateClusters": true + } + ], + "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "nonce": "00000001" +} \ No newline at end of file diff --git a/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden b/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden index f2bc276d8e9..959cc72d4ef 100644 --- a/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden +++ b/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden @@ -48,6 +48,11 @@ "headerName": "x-user-id" } }, + { + "queryParameter": { + "name": "my-pretty-param" + } + }, { "connectionProperties": { "sourceIp": true diff --git a/agent/xds/testdata/routes/terminating-gateway-lb-config.latest.golden b/agent/xds/testdata/routes/terminating-gateway-lb-config.latest.golden index cc49c907cce..30b36d92d19 100644 --- a/agent/xds/testdata/routes/terminating-gateway-lb-config.latest.golden +++ b/agent/xds/testdata/routes/terminating-gateway-lb-config.latest.golden @@ -1,40 +1,41 @@ { - "versionInfo": "00000001", - "resources": [ + "versionInfo": "00000001", + "resources": [ { - "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - "name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "virtualHosts": [ + "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "virtualHosts": [ { - "name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "domains": [ + "name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "domains": [ "*" ], - "routes": [ + "routes": [ { - "match": { - "prefix": "/" + "match": { + "prefix": "/" }, - "route": { - "cluster": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "autoHostRewrite": true, - "hashPolicy": [ + "route": { + "cluster": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "autoHostRewrite": true, + "timeout": "0.200s", + "hashPolicy": [ { - "cookie": { - "name": "chocolate-chip" + "cookie": { + "name": "chocolate-chip" }, - "terminal": true + "terminal": true }, { - "header": { - "headerName": "x-user-id" + "header": { + "headerName": "x-user-id" } }, { - "connectionProperties": { - "sourceIp": true + "connectionProperties": { + "sourceIp": true }, - "terminal": true + "terminal": true } ] } @@ -42,42 +43,43 @@ ] } ], - "validateClusters": true + "validateClusters": true }, { - "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - "name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "virtualHosts": [ + "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "virtualHosts": [ { - "name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "domains": [ + "name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "domains": [ "*" ], - "routes": [ + "routes": [ { - "match": { - "prefix": "/" + "match": { + "prefix": "/" }, - "route": { - "cluster": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "autoHostRewrite": true, - "hashPolicy": [ + "route": { + "cluster": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "autoHostRewrite": true, + "timeout": "0.200s", + "hashPolicy": [ { - "cookie": { - "name": "chocolate-chip" + "cookie": { + "name": "chocolate-chip" }, - "terminal": true + "terminal": true }, { - "header": { - "headerName": "x-user-id" + "header": { + "headerName": "x-user-id" } }, { - "connectionProperties": { - "sourceIp": true + "connectionProperties": { + "sourceIp": true }, - "terminal": true + "terminal": true } ] } @@ -85,42 +87,43 @@ ] } ], - "validateClusters": true + "validateClusters": true }, { - "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - "name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "virtualHosts": [ + "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "virtualHosts": [ { - "name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "domains": [ + "name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "domains": [ "*" ], - "routes": [ + "routes": [ { - "match": { - "prefix": "/" + "match": { + "prefix": "/" }, - "route": { - "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "autoHostRewrite": true, - "hashPolicy": [ + "route": { + "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "autoHostRewrite": true, + "timeout": "0.200s", + "hashPolicy": [ { - "cookie": { - "name": "chocolate-chip" + "cookie": { + "name": "chocolate-chip" }, - "terminal": true + "terminal": true }, { - "header": { - "headerName": "x-user-id" + "header": { + "headerName": "x-user-id" } }, { - "connectionProperties": { - "sourceIp": true + "connectionProperties": { + "sourceIp": true }, - "terminal": true + "terminal": true } ] } @@ -128,9 +131,9 @@ ] } ], - "validateClusters": true + "validateClusters": true } ], - "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - "nonce": "00000001" + "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", + "nonce": "00000001" } \ No newline at end of file