diff --git a/agent/proxycfg/mesh_gateway.go b/agent/proxycfg/mesh_gateway.go index c9fe60a892..fd2886eca5 100644 --- a/agent/proxycfg/mesh_gateway.go +++ b/agent/proxycfg/mesh_gateway.go @@ -295,7 +295,7 @@ func (s *handlerMeshGateway) handleUpdate(ctx context.Context, u UpdateEvent, sn QueryOptions: structs.QueryOptions{Token: s.token}, ServiceKind: structs.ServiceKindMeshGateway, UseServiceKind: true, - NodesOnly: true, + NodesOnly: false, Source: *s.source, EnterpriseMeta: *entMeta, }, fmt.Sprintf("mesh-gateway:%s", gk.String()), s.ch) diff --git a/agent/proxycfg/state.go b/agent/proxycfg/state.go index a113903c15..7256c3dbcc 100644 --- a/agent/proxycfg/state.go +++ b/agent/proxycfg/state.go @@ -544,7 +544,7 @@ func watchMeshGateway(ctx context.Context, opts gatewayWatchOpts) error { QueryOptions: structs.QueryOptions{Token: opts.token}, ServiceKind: structs.ServiceKindMeshGateway, UseServiceKind: true, - NodesOnly: true, + NodesOnly: false, Source: opts.source, EnterpriseMeta: *structs.DefaultEnterpriseMetaInPartition(opts.key.Partition), }, correlationId, opts.notifyCh) diff --git a/agent/proxycfg/upstreams.go b/agent/proxycfg/upstreams.go index 6e3ea3af65..209a3446d9 100644 --- a/agent/proxycfg/upstreams.go +++ b/agent/proxycfg/upstreams.go @@ -354,14 +354,14 @@ func (s *handlerUpstreams) resetWatchesFromChain( Partition: s.proxyID.PartitionOrDefault(), Datacenter: s.source.Datacenter, } - //default: - // // if target.MeshGateway.Mode is not set and target is not peered we don't want to set up watches for the gateway. - // // This is important specifically in wan-fed without mesh gateway use case, as for this case - // //the source and target DC could be different but there is not mesh-gateway so no need to watch - // // a costly watch (Internal.ServiceDump) - // if target.Peer == "" { - // continue - // } + default: + // if target.MeshGateway.Mode is not set and target is not peered we don't want to set up watches for the gateway. + // This is important specifically in wan-fed without mesh gateway use case, as for this case + //the source and target DC could be different but there is not mesh-gateway so no need to watch + // a costly watch (Internal.ServiceDump) + if target.Peer == "" { + continue + } } if s.source.Datacenter != target.Datacenter || s.proxyID.PartitionOrDefault() != target.Partition { needGateways[gk.String()] = struct{}{}