Remove unused are hosts set check (#16691)

* Remove unused are hosts set check

* Remove all traces of unused 'AreHostsSet' parameter

* Remove unused Hosts attribute

* Remove commented out use of snap.APIGateway.Hosts
pull/16710/head^2
John Maguire 2 years ago committed by GitHub
parent 1f4c590f2c
commit 8dd1d73874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -392,8 +392,6 @@ func (h *handlerAPIGateway) handleRouteConfigUpdate(ctx context.Context, u Updat
snap.APIGateway.Upstreams.set(ref, listener, set) snap.APIGateway.Upstreams.set(ref, listener, set)
} }
snap.APIGateway.UpstreamsSet.set(ref, seenUpstreamIDs) snap.APIGateway.UpstreamsSet.set(ref, seenUpstreamIDs)
// snap.APIGateway.Hosts = TODO
snap.APIGateway.AreHostsSet = true
// Stop watching any upstreams and discovery chains that have become irrelevant // Stop watching any upstreams and discovery chains that have become irrelevant
for upstreamID, cancelDiscoChain := range snap.APIGateway.WatchedDiscoveryChains { for upstreamID, cancelDiscoChain := range snap.APIGateway.WatchedDiscoveryChains {

@ -255,10 +255,6 @@ func (o *configSnapshotAPIGateway) DeepCopy() *configSnapshotAPIGateway {
if o.BoundGatewayConfig != nil { if o.BoundGatewayConfig != nil {
cp.BoundGatewayConfig = o.BoundGatewayConfig.DeepCopy() cp.BoundGatewayConfig = o.BoundGatewayConfig.DeepCopy()
} }
if o.Hosts != nil {
cp.Hosts = make([]string, len(o.Hosts))
copy(cp.Hosts, o.Hosts)
}
if o.Upstreams != nil { if o.Upstreams != nil {
cp.Upstreams = make(map[structs.ResourceReference]listenerUpstreamMap, len(o.Upstreams)) cp.Upstreams = make(map[structs.ResourceReference]listenerUpstreamMap, len(o.Upstreams))
for k2, v2 := range o.Upstreams { for k2, v2 := range o.Upstreams {

@ -666,8 +666,10 @@ func (r routeUpstreamSet) delete(route structs.ResourceReference) {
delete(r, route) delete(r, route)
} }
type listenerUpstreamMap map[APIGatewayListenerKey]structs.Upstreams type (
type listenerRouteUpstreams map[structs.ResourceReference]listenerUpstreamMap listenerUpstreamMap map[APIGatewayListenerKey]structs.Upstreams
listenerRouteUpstreams map[structs.ResourceReference]listenerUpstreamMap
)
func (l listenerRouteUpstreams) set(route structs.ResourceReference, listener APIGatewayListenerKey, upstreams structs.Upstreams) { func (l listenerRouteUpstreams) set(route structs.ResourceReference, listener APIGatewayListenerKey, upstreams structs.Upstreams) {
if _, ok := l[route]; !ok { if _, ok := l[route]; !ok {
@ -705,13 +707,9 @@ type configSnapshotAPIGateway struct {
BoundGatewayConfigLoaded bool BoundGatewayConfigLoaded bool
BoundGatewayConfig *structs.BoundAPIGatewayConfigEntry BoundGatewayConfig *structs.BoundAPIGatewayConfigEntry
// Hosts is the list of extra host entries to add to our leaf cert's DNS SANs
Hosts []string
AreHostsSet bool
// LeafCertWatchCancel is a CancelFunc to use when refreshing this gateway's // LeafCertWatchCancel is a CancelFunc to use when refreshing this gateway's
// leaf cert watch with different parameters. // leaf cert watch with different parameters.
//LeafCertWatchCancel context.CancelFunc // LeafCertWatchCancel context.CancelFunc
// Upstreams is a list of upstreams this ingress gateway should serve traffic // Upstreams is a list of upstreams this ingress gateway should serve traffic
// to. This is constructed from the ingress-gateway config entry, and uses // to. This is constructed from the ingress-gateway config entry, and uses
@ -1079,7 +1077,6 @@ func (s *ConfigSnapshot) Valid() bool {
s.APIGateway.Leaf != nil && s.APIGateway.Leaf != nil &&
s.APIGateway.GatewayConfigLoaded && s.APIGateway.GatewayConfigLoaded &&
s.APIGateway.BoundGatewayConfigLoaded && s.APIGateway.BoundGatewayConfigLoaded &&
s.APIGateway.AreHostsSet &&
s.APIGateway.MeshConfigSet s.APIGateway.MeshConfigSet
default: default:
return false return false
@ -1121,8 +1118,8 @@ func (s *ConfigSnapshot) Clone() *ConfigSnapshot {
snap.APIGateway.WatchedDiscoveryChains = nil snap.APIGateway.WatchedDiscoveryChains = nil
// only api-gateway // only api-gateway
//snap.APIGateway.LeafCertWatchCancel = nil // snap.APIGateway.LeafCertWatchCancel = nil
//snap.APIGateway. // snap.APIGateway.
} }
return snap return snap

Loading…
Cancel
Save