grpc-js-xds: NACK WeightedCluster if total_weight is 0

This commit is contained in:
Michael Lumish 2022-09-12 13:47:57 -07:00
parent b8c0cdc480
commit 02a43a302d
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,9 @@ export class RdsState extends BaseXdsStreamState<RouteConfiguration__Output> imp
}
}
if (route.route!.cluster_specifier === 'weighted_clusters') {
if (route.route.weighted_clusters!.total_weight?.value === 0) {
return false;
}
let weightSum = 0;
for (const clusterWeight of route.route.weighted_clusters!.clusters) {
weightSum += clusterWeight.weight?.value ?? 0;