mirror of https://github.com/hashicorp/consul
do not init local gateways watch as it's not relevant for remote gateways. do not prevent remote gateway watch from being created when a local one exist as both are different.
parent
50fb45ac74
commit
7b41a61c17
|
@ -1073,8 +1073,8 @@ func TestState_WatchesAndUpdates(t *testing.T) {
|
|||
require.Equal(t, ixnMatch, snap.ConnectProxy.Intentions)
|
||||
require.True(t, snap.ConnectProxy.MeshConfigSet)
|
||||
|
||||
// We only watched a single service which is peered
|
||||
require.Equal(t, 1, snap.ConnectProxy.WatchedLocalGWEndpoints.Len())
|
||||
// No event is expected as all services use default or remote mode
|
||||
require.Equal(t, 0, snap.ConnectProxy.WatchedLocalGWEndpoints.Len())
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -363,15 +363,12 @@ func (s *handlerUpstreams) resetWatchesFromChain(
|
|||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if s.source.Datacenter != target.Datacenter || s.proxyID.PartitionOrDefault() != target.Partition {
|
||||
needGateways[gk.String()] = struct{}{}
|
||||
}
|
||||
// Register a local gateway watch if any targets are pointing to a peer and require a mode of local.
|
||||
if target.Peer != "" && target.MeshGateway.Mode == structs.MeshGatewayModeLocal {
|
||||
s.setupWatchForLocalGWEndpoints(ctx, snap)
|
||||
} else {
|
||||
// If it's not a peering use case, consider watching the gateways for remote targets in wan-fed
|
||||
if s.source.Datacenter != target.Datacenter || s.proxyID.PartitionOrDefault() != target.Partition {
|
||||
needGateways[gk.String()] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,7 +426,6 @@ func (s *handlerUpstreams) resetWatchesFromChain(
|
|||
cancel()
|
||||
return err
|
||||
}
|
||||
snap.WatchedLocalGWEndpoints.InitWatch(gwKey.String(), nil)
|
||||
snap.WatchedGateways[uid][key] = cancel
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue