Upstreams loop is only for prepared queries and they are not CentrallyConfigured

This commit is contained in:
freddygv 2021-03-17 15:32:52 -06:00
parent 9256d09255
commit 4c58711594
1 changed files with 3 additions and 6 deletions

View File

@ -242,9 +242,9 @@ func (s *Server) listenersFromSnapshotConnectProxy(cInfo connectionInfo, cfgSnap
resources = append(resources, outboundListener) resources = append(resources, outboundListener)
} }
// Looping over explicit upstreams is only needed for prepared queries because they do not have discovery chains
for id, u := range cfgSnap.ConnectProxy.UpstreamConfig { for id, u := range cfgSnap.ConnectProxy.UpstreamConfig {
if _, ok := cfgSnap.ConnectProxy.DiscoveryChain[id]; ok && u.DestinationType != structs.UpstreamDestTypePreparedQuery { if u.DestinationType != structs.UpstreamDestTypePreparedQuery {
// This upstream is already covered above
continue continue
} }
@ -258,10 +258,7 @@ func (s *Server) listenersFromSnapshotConnectProxy(cInfo connectionInfo, cfgSnap
if u.LocalBindAddress != "" { if u.LocalBindAddress != "" {
address = u.LocalBindAddress address = u.LocalBindAddress
} }
// This is the case where upstream config is centralized but no port was specified
if u.LocalBindPort == 0 {
continue
}
upstreamListener := makeListener(id, address, u.LocalBindPort, envoy_core_v3.TrafficDirection_OUTBOUND) upstreamListener := makeListener(id, address, u.LocalBindPort, envoy_core_v3.TrafficDirection_OUTBOUND)
filterChain, err := s.makeUpstreamFilterChainForDiscoveryChain( filterChain, err := s.makeUpstreamFilterChainForDiscoveryChain(