From c72bbb6e8d81294b1533870306fba88dc3222f7e Mon Sep 17 00:00:00 2001 From: freddygv Date: Tue, 26 Oct 2021 16:25:35 -0600 Subject: [PATCH] Split up locality check from hostname check --- agent/xds/endpoints.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/agent/xds/endpoints.go b/agent/xds/endpoints.go index 3cc2c4dd16..073a7ac320 100644 --- a/agent/xds/endpoints.go +++ b/agent/xds/endpoints.go @@ -114,11 +114,12 @@ func (s *ResourceGenerator) endpointsFromSnapshotMeshGateway(cfgSnap *proxycfg.C resources := make([]proto.Message, 0, len(keys)+len(cfgSnap.MeshGateway.ServiceGroups)) for _, key := range keys { - // Skip creating endpoints for mesh gateways in local DC/partition. + if key.Matches(cfgSnap.Datacenter, cfgSnap.ProxyID.PartitionOrEmpty()) { + continue // skip local + } // Also skip gateways with a hostname as their address. EDS cannot resolve hostnames, // so we provide them through CDS instead. - if key.Matches(cfgSnap.Datacenter, cfgSnap.ProxyID.PartitionOrEmpty()) || - len(cfgSnap.MeshGateway.HostnameDatacenters[key.String()]) > 0 { + if len(cfgSnap.MeshGateway.HostnameDatacenters[key.String()]) > 0 { continue }