diff --git a/.changelog/20011.txt b/.changelog/20011.txt new file mode 100644 index 0000000000000..f9dc812f200cc --- /dev/null +++ b/.changelog/20011.txt @@ -0,0 +1,3 @@ +```release-note:improvement +xds: replace usage of deprecated Envoy field envoy.config.router.v3.WeightedCluster.total_weight` +``` \ No newline at end of file diff --git a/.github/workflows/nightly-test-integrations.yml b/.github/workflows/nightly-test-integrations.yml index 32e09f2e34c15..a79d102b5e5b7 100644 --- a/.github/workflows/nightly-test-integrations.yml +++ b/.github/workflows/nightly-test-integrations.yml @@ -196,7 +196,7 @@ jobs: consul-version: [ "1.16", "1.17"] env: CONSUL_LATEST_VERSION: ${{ matrix.consul-version }} - ENVOY_VERSION: "1.28.0" + ENVOY_VERSION: "1.25.4" steps: - name: Checkout code uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 diff --git a/.github/workflows/test-integrations.yml b/.github/workflows/test-integrations.yml index ebcf70bb65d6e..4dbbedf092495 100644 --- a/.github/workflows/test-integrations.yml +++ b/.github/workflows/test-integrations.yml @@ -383,7 +383,7 @@ jobs: id-token: write # NOTE: this permission is explicitly required for Vault auth. contents: read env: - ENVOY_VERSION: "1.28.0" + ENVOY_VERSION: "1.25.4" CONSUL_DATAPLANE_IMAGE: "docker.io/hashicorppreview/consul-dataplane:1.3-dev-ubi" steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 diff --git a/Makefile b/Makefile index ca186b426f75c..228c3779562ba 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ GO_BUILD_TAG?=consul-build-go UI_BUILD_TAG?=consul-build-ui BUILD_CONTAINER_NAME?=consul-builder CONSUL_IMAGE_VERSION?=latest -ENVOY_VERSION?='1.28.0' +ENVOY_VERSION?='1.25.4' CONSUL_DATAPLANE_IMAGE := $(or $(CONSUL_DATAPLANE_IMAGE),"docker.io/hashicorppreview/consul-dataplane:1.3-dev-ubi") DEPLOYER_CONSUL_DATAPLANE_IMAGE := $(or $(DEPLOYER_CONSUL_DATAPLANE_IMAGE), "docker.io/hashicorppreview/consul-dataplane:1.3-dev") diff --git a/agent/xds/routes.go b/agent/xds/routes.go index 3cc3ec351080c..9eb8375ed9d7f 100644 --- a/agent/xds/routes.go +++ b/agent/xds/routes.go @@ -17,16 +17,14 @@ import ( "golang.org/x/exp/maps" "golang.org/x/exp/slices" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/wrapperspb" - "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/agent/consul/discoverychain" "github.com/hashicorp/consul/agent/proxycfg" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/agent/xds/config" "github.com/hashicorp/consul/agent/xds/response" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/durationpb" ) // routesFromSnapshot returns the xDS API representation of the "routes" in the @@ -1016,7 +1014,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] @@ -1033,7 +1030,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: response.MakeUint32Value(weight), Name: clusterName, @@ -1049,18 +1045,11 @@ func (s *ResourceGenerator) makeRouteActionForSplitter( return nil, fmt.Errorf("number of clusters in splitter must be > 0; got %d", len(clusters)) } - var envoyWeightScale *wrapperspb.UInt32Value - if totalWeight == 10000 { - envoyWeightScale = response.MakeUint32Value(10000) - } - return &envoy_route_v3.Route_Route{ Route: &envoy_route_v3.RouteAction{ ClusterSpecifier: &envoy_route_v3.RouteAction_WeightedClusters{ WeightedClusters: &envoy_route_v3.WeightedCluster{ Clusters: clusters, - // this field is deprecated, and we should get the desired behavior with the front-end validation - TotalWeight: envoyWeightScale, // scaled up 100% }, }, }, 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 dc51ff588d730..50acae3b21ab8 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 @@ -28,8 +28,7 @@ "name": "v2.db.default.dc2.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 5000 } - ], - "totalWeight": 10000 + ] } } } 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 f748c3e8208ed..195aa3f77aeb5 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 @@ -57,8 +57,7 @@ "name": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 450 } - ], - "totalWeight": 10000 + ] } } } 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 958709e3477e8..0075347487107 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 @@ -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/connect-proxy-with-chain-and-splitter.latest.golden b/agent/xds/testdata/routes/connect-proxy-with-chain-and-splitter.latest.golden index 2b223aef998e0..e654d9aa4d151 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 @@ -125,8 +125,7 @@ ], "weight": 50 } - ], - "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 9660fb81a608a..71f6e9893f607 100644 --- a/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden +++ b/agent/xds/testdata/routes/ingress-lb-in-resolver.latest.golden @@ -58,8 +58,7 @@ "name": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", "weight": 450 } - ], - "totalWeight": 10000 + ] } } } 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 bf15c92982e7e..d3a2ea221999b 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 @@ -28,8 +28,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 2a55ed3395002..7c92fc2f65452 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 @@ -399,8 +399,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 dac7fbcf0f281..b7c4114a4c445 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 @@ -361,8 +361,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 c8e50d10c7ebf..f85d5c038f521 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 @@ -126,8 +126,7 @@ ], "weight": 50 } - ], - "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 825473467d5ec..74385c3103052 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 @@ -27,8 +27,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 8c192286007cf..40722e65ce829 100644 --- a/agent/xds/testdata/routes/splitter-with-resolver-redirect.latest.golden +++ b/agent/xds/testdata/routes/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/xds-fetch-timeout-ms-ingress-with-router.latest.golden b/agent/xds/testdata/routes/xds-fetch-timeout-ms-ingress-with-router.latest.golden index dac7fbcf0f281..b7c4114a4c445 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 @@ -361,8 +361,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/xds-fetch-timeout-ms-sidecar.latest.golden b/agent/xds/testdata/routes/xds-fetch-timeout-ms-sidecar.latest.golden index 958709e3477e8..0075347487107 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 @@ -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/xdsv2/route_resources.go b/agent/xdsv2/route_resources.go index 073b89d22ca87..afbb7f26d4eab 100644 --- a/agent/xdsv2/route_resources.go +++ b/agent/xdsv2/route_resources.go @@ -264,22 +264,15 @@ func (pr *ProxyResources) makeEnvoyRouteActionFromProxystateRouteDestination(psR case *pbproxystate.RouteDestination_WeightedClusters: psWeightedClusters := psRouteDestination.GetWeightedClusters() envoyClusters := make([]*envoy_route_v3.WeightedCluster_ClusterWeight, 0, len(psWeightedClusters.GetClusters())) - totalWeight := 0 for _, psCluster := range psWeightedClusters.GetClusters() { pr.addEnvoyClustersAndEndpointsToEnvoyResources(psCluster.Name) - totalWeight += int(psCluster.Weight.GetValue()) envoyClusters = append(envoyClusters, makeEnvoyClusterWeightFromProxystateWeightedCluster(psCluster)) } - var envoyWeightScale *wrapperspb.UInt32Value - if totalWeight == 10000 { - envoyWeightScale = response.MakeUint32Value(10000) - } envoyRouteRoute.Route.ClusterSpecifier = &envoy_route_v3.RouteAction_WeightedClusters{ WeightedClusters: &envoy_route_v3.WeightedCluster{ - Clusters: envoyClusters, - TotalWeight: envoyWeightScale, + Clusters: envoyClusters, }, } default: diff --git a/troubleshoot/proxy/testdata/config.json b/troubleshoot/proxy/testdata/config.json index 9a2e88578bca7..b9495c2290922 100644 --- a/troubleshoot/proxy/testdata/config.json +++ b/troubleshoot/proxy/testdata/config.json @@ -2241,8 +2241,7 @@ "name": "backend2.default.dc1.internal.7838b4bd-58b3-8117-3df1-60584910541b.consul", "weight": 5000 } - ], - "total_weight": 10000 + ] } } } 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 + ] } } }