mirror of https://github.com/status-im/consul.git
Allow terminating-gateway to setup listener before servicegroups are known
This commit is contained in:
parent
913b13f31f
commit
c0e1751878
|
@ -2,7 +2,6 @@ package proxycfg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/agent/structs"
|
"github.com/hashicorp/consul/agent/structs"
|
||||||
"github.com/mitchellh/copystructure"
|
"github.com/mitchellh/copystructure"
|
||||||
)
|
)
|
||||||
|
|
|
@ -591,6 +591,20 @@ func (s *Server) makeTerminatingGatewayListener(name, addr string, port int, cfg
|
||||||
|
|
||||||
err = injectConnectFilters(cfgSnap, token, l, false)
|
err = injectConnectFilters(cfgSnap, token, l, false)
|
||||||
|
|
||||||
|
// This fallback catch-all filter ensures a listener will be present for health checks to pass
|
||||||
|
// Envoy will reset these connections since known endpoints are caught by filter chain matches above
|
||||||
|
tcpProxy, err := makeTCPProxyFilter(name, "", "terminating_gateway_")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fallback := envoylistener.FilterChain{
|
||||||
|
Filters: []envoylistener.Filter{
|
||||||
|
{Name: "envoy.filters.network.sni_cluster"},
|
||||||
|
tcpProxy,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
l.FilterChains = append(l.FilterChains, fallback)
|
||||||
|
|
||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,8 +219,8 @@ func (s *Server) process(stream ADSStream, reqCh <-chan *envoy.DiscoveryRequest)
|
||||||
resources: s.clustersFromSnapshot,
|
resources: s.clustersFromSnapshot,
|
||||||
stream: stream,
|
stream: stream,
|
||||||
allowEmptyFn: func(cfgSnap *proxycfg.ConfigSnapshot) bool {
|
allowEmptyFn: func(cfgSnap *proxycfg.ConfigSnapshot) bool {
|
||||||
// Mesh gateways are allowed to inform CDS of no clusters.
|
// Mesh and Terminating gateways are allowed to inform CDS of no clusters.
|
||||||
return cfgSnap.Kind == structs.ServiceKindMeshGateway
|
return cfgSnap.Kind == structs.ServiceKindMeshGateway || cfgSnap.Kind == structs.ServiceKindTerminatingGateway
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RouteType: {
|
RouteType: {
|
||||||
|
|
Loading…
Reference in New Issue