diff --git a/.changelog/20011.txt b/.changelog/20011.txt new file mode 100644 index 0000000000000..e20c69508bdc0 --- /dev/null +++ b/.changelog/20011.txt @@ -0,0 +1,3 @@ +```release-note:improvement +connect: replace usage of deprecated Envoy field `envoy.config.router.v3.WeightedCluster.total_weight`. +``` \ No newline at end of file diff --git a/agent/xds/routes.go b/agent/xds/routes.go index 8adcd8abfce3a..c753aa0b2e560 100644 --- a/agent/xds/routes.go +++ b/agent/xds/routes.go @@ -950,7 +950,6 @@ func (s *ResourceGenerator) makeRouteActionForSplitter( forMeshGateway bool, ) (*envoy_route_v3.Route_Route, error) { clusters := make([]*envoy_route_v3.WeightedCluster_ClusterWeight, 0, len(splits)) - totalWeight := 0 for _, split := range splits { nextNode := chain.Nodes[split.NextNode] @@ -967,7 +966,6 @@ func (s *ResourceGenerator) makeRouteActionForSplitter( // The smallest representable weight is 1/10000 or .01% but envoy // deals with integers so scale everything up by 100x. weight := int(split.Weight * 100) - totalWeight += weight cw := &envoy_route_v3.WeightedCluster_ClusterWeight{ Weight: makeUint32Value(weight), Name: clusterName, @@ -983,19 +981,11 @@ func (s *ResourceGenerator) makeRouteActionForSplitter( return nil, fmt.Errorf("number of clusters in splitter must be > 0; got %d", len(clusters)) } - envoyWeightScale := 10000 - if envoyWeightScale < totalWeight { - clusters[0].Weight.Value += uint32(totalWeight - envoyWeightScale) - } else { - clusters[0].Weight.Value += uint32(envoyWeightScale - totalWeight) - } - return &envoy_route_v3.Route_Route{ Route: &envoy_route_v3.RouteAction{ ClusterSpecifier: &envoy_route_v3.RouteAction_WeightedClusters{ WeightedClusters: &envoy_route_v3.WeightedCluster{ - Clusters: clusters, - TotalWeight: makeUint32Value(envoyWeightScale), // scaled up 100% + Clusters: clusters, }, }, }, diff --git a/agent/xds/testdata/builtin_extension/routes/propertyoverride-patch-specific-upstream-service-splitter.latest.golden b/agent/xds/testdata/builtin_extension/routes/propertyoverride-patch-specific-upstream-service-splitter.latest.golden index 0f6260527b48d..838718bdea8e5 100644 --- a/agent/xds/testdata/builtin_extension/routes/propertyoverride-patch-specific-upstream-service-splitter.latest.golden +++ b/agent/xds/testdata/builtin_extension/routes/propertyoverride-patch-specific-upstream-service-splitter.latest.golden @@ -26,8 +26,7 @@ "name": "v2.db.default.dc2.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 5000 } - ], - "totalWeight": 10000 + ] } } } @@ -40,4 +39,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden b/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden index 9cac480402557..f78ed0f25a731 100644 --- a/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden +++ b/agent/xds/testdata/routes/connect-proxy-lb-in-resolver.latest.golden @@ -64,4 +64,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden b/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden index d34194b932328..2b986106f3219 100644 --- a/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden +++ b/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden @@ -359,8 +359,7 @@ "name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 50 } - ], - "totalWeight": 10000 + ] } } }, diff --git a/agent/xds/testdata/routes/connect-proxy-with-chain-and-splitter.latest.golden b/agent/xds/testdata/routes/connect-proxy-with-chain-and-splitter.latest.golden index 9dde104442a9e..52b50b0c5c649 100644 --- a/agent/xds/testdata/routes/connect-proxy-with-chain-and-splitter.latest.golden +++ b/agent/xds/testdata/routes/connect-proxy-with-chain-and-splitter.latest.golden @@ -84,8 +84,7 @@ } ] } - ], - "totalWeight": 10000 + ] } } } diff --git a/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden b/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden index f2bc276d8e99b..763104384507c 100644 --- a/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden +++ b/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden @@ -65,4 +65,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/ingress-splitter-with-resolver-redirect.latest.golden b/agent/xds/testdata/routes/ingress-splitter-with-resolver-redirect.latest.golden index 4c3fee303cb62..293b41bc63e7e 100644 --- a/agent/xds/testdata/routes/ingress-splitter-with-resolver-redirect.latest.golden +++ b/agent/xds/testdata/routes/ingress-splitter-with-resolver-redirect.latest.golden @@ -27,8 +27,7 @@ "name": "v2.db.default.dc2.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 5000 } - ], - "totalWeight": 10000 + ] } } } diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden index 1fa06838f8d83..89abb4cc13212 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden @@ -360,8 +360,7 @@ "name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 50 } - ], - "totalWeight": 10000 + ] } } }, diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden index ffe7313996f15..a3708e3d09b45 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden @@ -360,8 +360,7 @@ "name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 50 } - ], - "totalWeight": 10000 + ] } } }, diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-splitter.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-splitter.latest.golden index 820de54764f3e..b307ea4140514 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-splitter.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-splitter.latest.golden @@ -85,8 +85,7 @@ } ] } - ], - "totalWeight": 10000 + ] } } } diff --git a/agent/xds/testdata/routes/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden b/agent/xds/testdata/routes/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden index ce1c0ad2d5cbf..e83002f92e686 100644 --- a/agent/xds/testdata/routes/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden +++ b/agent/xds/testdata/routes/mesh-gateway-with-exported-peered-services-http-with-router.latest.golden @@ -26,8 +26,7 @@ "name": "exported~db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 4000 } - ], - "totalWeight": 10000 + ] } } }, diff --git a/agent/xds/testdata/routes/splitter-with-resolver-redirect.latest.golden b/agent/xds/testdata/routes/splitter-with-resolver-redirect.latest.golden index dec26fd159944..839c96081bfed 100644 --- a/agent/xds/testdata/routes/splitter-with-resolver-redirect.latest.golden +++ b/agent/xds/testdata/routes/splitter-with-resolver-redirect.latest.golden @@ -26,8 +26,7 @@ "name": "v2.db.default.dc2.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 5000 } - ], - "totalWeight": 10000 + ] } } } diff --git a/agent/xds/testdata/routes/xds-fetch-timeout-ms-ingress-with-router.latest.golden b/agent/xds/testdata/routes/xds-fetch-timeout-ms-ingress-with-router.latest.golden index d3a982eb78e20..084ba1a6844c7 100644 --- a/agent/xds/testdata/routes/xds-fetch-timeout-ms-ingress-with-router.latest.golden +++ b/agent/xds/testdata/routes/xds-fetch-timeout-ms-ingress-with-router.latest.golden @@ -350,8 +350,7 @@ "name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 50 } - ], - "totalWeight": 10000 + ] } } }, @@ -417,4 +416,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/xds-fetch-timeout-ms-sidecar.latest.golden b/agent/xds/testdata/routes/xds-fetch-timeout-ms-sidecar.latest.golden index 4a47d4b548a0a..c469bfb1deab1 100644 --- a/agent/xds/testdata/routes/xds-fetch-timeout-ms-sidecar.latest.golden +++ b/agent/xds/testdata/routes/xds-fetch-timeout-ms-sidecar.latest.golden @@ -349,8 +349,7 @@ "name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 50 } - ], - "totalWeight": 10000 + ] } } }, @@ -416,4 +415,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/troubleshoot/proxy/testdata/upstreams/config.json b/troubleshoot/proxy/testdata/upstreams/config.json index 735e329597f88..62a8d29787645 100644 --- a/troubleshoot/proxy/testdata/upstreams/config.json +++ b/troubleshoot/proxy/testdata/upstreams/config.json @@ -174,8 +174,7 @@ "name": "backend2.default.dc1.internal.domain.consul", "weight": 5000 } - ], - "total_weight": 10000 + ] } } }