Browse Source

add missing test data and golden files

pull/13596/head
Dhia Ayachi 2 years ago
parent
commit
fb4859461a
  1. 2
      agent/proxycfg/data_sources.go
  2. 3
      agent/proxycfg/testing.go
  3. 7
      agent/xds/listeners.go

2
agent/proxycfg/data_sources.go

@ -47,7 +47,7 @@ type DataSources struct {
// notification channel. // notification channel.
GatewayServices GatewayServices GatewayServices GatewayServices
// GatewayServices provides updates about a gateway's upstream services on a // ServiceGateways provides updates about a gateway's upstream services on a
// notification channel. // notification channel.
ServiceGateways ServiceGateways ServiceGateways ServiceGateways

3
agent/proxycfg/testing.go

@ -743,6 +743,7 @@ func testConfigSnapshotFixture(
Datacenters: &noopDataSource[*structs.DatacentersRequest]{}, Datacenters: &noopDataSource[*structs.DatacentersRequest]{},
FederationStateListMeshGateways: &noopDataSource[*structs.DCSpecificRequest]{}, FederationStateListMeshGateways: &noopDataSource[*structs.DCSpecificRequest]{},
GatewayServices: &noopDataSource[*structs.ServiceSpecificRequest]{}, GatewayServices: &noopDataSource[*structs.ServiceSpecificRequest]{},
ServiceGateways: &noopDataSource[*structs.ServiceSpecificRequest]{},
Health: &noopDataSource[*structs.ServiceSpecificRequest]{}, Health: &noopDataSource[*structs.ServiceSpecificRequest]{},
HTTPChecks: &noopDataSource[*cachetype.ServiceHTTPChecksRequest]{}, HTTPChecks: &noopDataSource[*cachetype.ServiceHTTPChecksRequest]{},
Intentions: &noopDataSource[*structs.IntentionQueryRequest]{}, Intentions: &noopDataSource[*structs.IntentionQueryRequest]{},
@ -971,6 +972,7 @@ type TestDataSources struct {
FederationStateListMeshGateways *TestDataSource[*structs.DCSpecificRequest, *structs.DatacenterIndexedCheckServiceNodes] FederationStateListMeshGateways *TestDataSource[*structs.DCSpecificRequest, *structs.DatacenterIndexedCheckServiceNodes]
Datacenters *TestDataSource[*structs.DatacentersRequest, *[]string] Datacenters *TestDataSource[*structs.DatacentersRequest, *[]string]
GatewayServices *TestDataSource[*structs.ServiceSpecificRequest, *structs.IndexedGatewayServices] GatewayServices *TestDataSource[*structs.ServiceSpecificRequest, *structs.IndexedGatewayServices]
ServiceGateways *TestDataSource[*structs.ServiceSpecificRequest, *structs.IndexedServiceNodes]
Health *TestDataSource[*structs.ServiceSpecificRequest, *structs.IndexedCheckServiceNodes] Health *TestDataSource[*structs.ServiceSpecificRequest, *structs.IndexedCheckServiceNodes]
HTTPChecks *TestDataSource[*cachetype.ServiceHTTPChecksRequest, []structs.CheckType] HTTPChecks *TestDataSource[*cachetype.ServiceHTTPChecksRequest, []structs.CheckType]
Intentions *TestDataSource[*structs.IntentionQueryRequest, *structs.IndexedIntentionMatches] Intentions *TestDataSource[*structs.IntentionQueryRequest, *structs.IndexedIntentionMatches]
@ -995,6 +997,7 @@ func (t *TestDataSources) ToDataSources() DataSources {
ConfigEntryList: t.ConfigEntryList, ConfigEntryList: t.ConfigEntryList,
Datacenters: t.Datacenters, Datacenters: t.Datacenters,
GatewayServices: t.GatewayServices, GatewayServices: t.GatewayServices,
ServiceGateways: t.ServiceGateways,
Health: t.Health, Health: t.Health,
HTTPChecks: t.HTTPChecks, HTTPChecks: t.HTTPChecks,
Intentions: t.Intentions, Intentions: t.Intentions,

7
agent/xds/listeners.go

@ -234,7 +234,11 @@ func (s *ResourceGenerator) listenersFromSnapshotConnectProxy(cfgSnap *proxycfg.
upstreamCfg := cfgSnap.ConnectProxy.UpstreamConfig[uid] upstreamCfg := cfgSnap.ConnectProxy.UpstreamConfig[uid]
cfg := s.getAndModifyUpstreamConfigForListener(uid, upstreamCfg, nil) cfg := s.getAndModifyUpstreamConfigForListener(uid, upstreamCfg, nil)
filterName := fmt.Sprintf("%s.%s.%s.%s", destination.GetName(), destination.GetEnterpriseMeta().NamespaceOrDefault(), destination.GetEnterpriseMeta().PartitionOrDefault(), cfgSnap.Datacenter) filterName := fmt.Sprintf("%s.%s.%s.%s", destination.GetName(), destination.GetEnterpriseMeta().NamespaceOrDefault(), destination.GetEnterpriseMeta().PartitionOrDefault(), cfgSnap.Datacenter)
clusterName := filterName sni := connect.ServiceSNI(
uid.Name, "", uid.NamespaceOrDefault(), uid.PartitionOrDefault(), cfgSnap.Datacenter, cfgSnap.Roots.TrustDomain)
// Prefixed with destination to distinguish from non-passthrough clusters for the same upstream.
clusterName := "destination~" + sni
filterChain, err := s.makeUpstreamFilterChain(filterChainOpts{ filterChain, err := s.makeUpstreamFilterChain(filterChainOpts{
routeName: uid.EnvoyID(), routeName: uid.EnvoyID(),
clusterName: clusterName, clusterName: clusterName,
@ -1664,7 +1668,6 @@ func (s *ResourceGenerator) makeUpstreamFilterChain(opts filterChainOpts) (*envo
return nil, err return nil, err
} }
return &envoy_listener_v3.FilterChain{ return &envoy_listener_v3.FilterChain{
Name: opts.filterName,
Filters: []*envoy_listener_v3.Filter{ Filters: []*envoy_listener_v3.Filter{
filter, filter,
}, },

Loading…
Cancel
Save