[Feature Request] Health aware weighted clusters: do not route to unhealthy clusters
#43150 opened on Jan 25, 2026
Description
Title: Health aware weighted cluster routing
Description: Weighted clusters are frequently used to route to remote ingress endpoints which tend to be single VIPs. If one of the clusters is "unhealthy" traffic is still sent to the cluster even though it has NO healthy endpoints.
For the above use case this is not the expected or desired behaviour. So potentially this is a bug.
API change.
Add a health_aware_lb bool to weighted cluster: Do not route to a cluster with no healthy endpoints.
Implementation Plan https://github.com/envoyproxy/envoy/blob/2d3d05dff994eae57b628a765d9cc4958bd1b77e/source/common/router/weighted_cluster_specifier.h#L25
Thread thru health_aware_lb_ and update WeightedClustersConfigEntry::clusterWeight to also take Upstream::ClusterManager& cluster_manager and then something like this.
uint64_t clusterWeight(Runtime::Loader& loader, Upstream::ClusterManager& cm) const {
auto weight = loader.snapshot().getInteger(runtime_key_, cluster_weight_);
if (health_aware_lb_ && weight > 0) {
auto* cluster = cm.getThreadLocalCluster(cluster_name_);
if (cluster != nullptr) {
for (const auto& ps : cluster->prioritySet().hostSetsPerPriority()) {
if (!ps->healthyHosts().empty()) {
return weight;
}
}
return 0;
}
}
return weight;
}