Avoid adding original_dst filter when not needed (#10302)

This commit is contained in:
Freddy 2021-05-26 15:04:45 -06:00 committed by GitHub
parent 6bdaf72085
commit 7cfd7e9ec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 16 deletions

4
.changelog/10302.txt Normal file
View File

@ -0,0 +1,4 @@
```release-note:improvement
connect: Avoid adding original_dst listener filter when it won't be used.
```

View File

@ -78,12 +78,6 @@ func (s *ResourceGenerator) listenersFromSnapshotConnectProxy(cfgSnap *proxycfg.
outboundListener = makePortListener(OutboundListenerName, "127.0.0.1", port, envoy_core_v3.TrafficDirection_OUTBOUND) outboundListener = makePortListener(OutboundListenerName, "127.0.0.1", port, envoy_core_v3.TrafficDirection_OUTBOUND)
outboundListener.FilterChains = make([]*envoy_listener_v3.FilterChain, 0) outboundListener.FilterChains = make([]*envoy_listener_v3.FilterChain, 0)
outboundListener.ListenerFilters = []*envoy_listener_v3.ListenerFilter{
{
// TODO (freddy): Hard-coded until we upgrade the go-control-plane library
Name: "envoy.filters.listener.original_dst",
},
}
} }
var hasFilterChains bool var hasFilterChains bool
@ -207,6 +201,13 @@ func (s *ResourceGenerator) listenersFromSnapshotConnectProxy(cfgSnap *proxycfg.
if cfgSnap.ConnectProxy.MeshConfig == nil || if cfgSnap.ConnectProxy.MeshConfig == nil ||
!cfgSnap.ConnectProxy.MeshConfig.TransparentProxy.CatalogDestinationsOnly { !cfgSnap.ConnectProxy.MeshConfig.TransparentProxy.CatalogDestinationsOnly {
outboundListener.ListenerFilters = []*envoy_listener_v3.ListenerFilter{
{
// TODO (freddy): Hard-coded until we upgrade the go-control-plane library
Name: "envoy.filters.listener.original_dst",
},
}
filterChain, err := s.makeUpstreamFilterChainForDiscoveryChain( filterChain, err := s.makeUpstreamFilterChainForDiscoveryChain(
"passthrough", "passthrough",
OriginalDestinationClusterName, OriginalDestinationClusterName,

View File

@ -57,11 +57,6 @@
] ]
} }
], ],
"listenerFilters": [
{
"name": "envoy.filters.listener.original_dst"
}
],
"trafficDirection": "OUTBOUND" "trafficDirection": "OUTBOUND"
}, },
{ {

View File

@ -57,11 +57,6 @@
] ]
} }
], ],
"listenerFilters": [
{
"name": "envoy.filters.listener.original_dst"
}
],
"trafficDirection": "OUTBOUND" "trafficDirection": "OUTBOUND"
}, },
{ {