From d3f490db612f84a1804e7330dd02350ab3dbd775 Mon Sep 17 00:00:00 2001 From: "nastassia.dailidava" Date: Tue, 17 Dec 2024 20:18:01 +0100 Subject: [PATCH] added log for empty load assignment --- .../snapshot/EnvoySnapshotFactory.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt index 99e8e006a..18c1f55d5 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt @@ -281,15 +281,7 @@ class EnvoySnapshotFactory( // ClusterLoadAssignments many times - it may reduce MEM, CPU and latency if some serviceTags are // commonly used endpointsFactory.filterEndpoints(endpoints, routeSpec.settings.routingPolicy).let { - endpointsFactory.assignLocalityWeights(routeSpec, it).also { la -> - if (la.endpointsList.any { el -> el.lbEndpointsList.isEmpty() } && - routeSpec.settings.routingPolicy.autoServiceTag) { - logger.warn( - "ClusterLoadAssignment for ${routeSpec.clusterName} has empty lbEndpoints, " + - "original clusterLoadAssignment: $endpoints" - ) - } - } + endpointsFactory.assignLocalityWeights(routeSpec, it) } } } @@ -345,7 +337,16 @@ class EnvoySnapshotFactory( val endpoints = getServicesEndpointsForGroup( group.proxySettings.incoming.rateLimitEndpoints, globalSnapshot, egressRouteSpecification - ) + ).also { e -> + val list = e.mapNotNull { el -> el.endpointsList.find { x -> x.lbEndpointsList.isEmpty() } } + if (list.isNotEmpty() && + group.proxySettings.outgoing.defaultServiceSettings.routingPolicy.autoServiceTag) { + logger.warn( + "Some of service ${group.serviceName} dependencies have ClusterLoadAssignment with empty " + + "lbEndpoints: $list" + ) + } + } val version = snapshotsVersions.version(group, clusters, endpoints, listeners, routes) return createSnapshot(