From 8b728cd7a5afa7c245ef6411d711a17dc231e271 Mon Sep 17 00:00:00 2001 From: Cybwan Date: Tue, 7 Jan 2025 22:06:39 +0800 Subject: [PATCH] refactor: ignore mesh services without ready endpoints. (#623) remove mesh services without ready endpoints. Signed-off-by: Cybwan --- pkg/catalog/outbound_traffic_policies.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/catalog/outbound_traffic_policies.go b/pkg/catalog/outbound_traffic_policies.go index b8a4761b..5cb59f27 100644 --- a/pkg/catalog/outbound_traffic_policies.go +++ b/pkg/catalog/outbound_traffic_policies.go @@ -49,6 +49,9 @@ func (mc *MeshCatalog) GetOutboundMeshTrafficPolicy(downstreamIdentity identity. // For each service, build the traffic policies required to access it. // It is important to aggregate HTTP route configs by the service's port. for _, meshSvc := range mc.ListOutboundServicesForIdentity(downstreamIdentity) { + if meshSvc.TargetPort == 0 { + continue + } meshSvc := meshSvc // To prevent loop variable memory aliasing in for loop egressEnabled, egressPolicyGetted, egressPolicy = mc.enableEgressSrviceForIdentity(downstreamIdentity, egressPolicyGetted, egressPolicy, meshSvc)