Skip to content

Commit 22cfb1a

Browse files
lb: hash policy support in the hash lb (#39505)
Commit Message: api: add hash policy to hash lb configuration Additional Description: > Now, the hash policy (header, cookie, source ip, etc.) is part of the route entry. But in actual practices, almost all well known control planes (istio, gloo, envoy gateway, etc) make the hash policy be part of upstream configurations (like destination rule of istio). > Route level hash policy not only bring compleixty of control plane developing, but make it's weird to configure multiple upstreams route with these control plane. > For example, given single route with two different upstreams that has different hash policies in the control plane, how control plane convert them to the envoy configuration? Address [#39502](envoyproxy/envoy#39502) Risk Level: low, api only. Testing: n/a. Docs Changes: n/a. Release Notes: n/a. Platform Specific Features: n/a. --------- Signed-off-by: wangbaiping(wbpcode) <[email protected]> Mirrored from https://github.com/envoyproxy/envoy @ 68998d38e5b084aa2af657bba1bed873f9de270f
1 parent 09409f4 commit 22cfb1a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

envoy/extensions/load_balancing_policies/common/v3/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ api_proto_package(
88
deps = [
99
"//envoy/annotations:pkg",
1010
"//envoy/config/core/v3:pkg",
11+
"//envoy/config/route/v3:pkg",
1112
"//envoy/type/v3:pkg",
1213
"@com_github_cncf_xds//udpa/annotations:pkg",
1314
],

envoy/extensions/load_balancing_policies/common/v3/common.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ syntax = "proto3";
33
package envoy.extensions.load_balancing_policies.common.v3;
44

55
import "envoy/config/core/v3/base.proto";
6+
import "envoy/config/route/v3/route_components.proto";
67
import "envoy/type/v3/percent.proto";
78

89
import "google/protobuf/duration.proto";
@@ -136,4 +137,10 @@ message ConsistentHashingLbConfig {
136137
// This is an O(N) algorithm, unlike other load balancers. Using a lower ``hash_balance_factor`` results in more hosts
137138
// being probed, so use a higher value if you require better performance.
138139
google.protobuf.UInt32Value hash_balance_factor = 2 [(validate.rules).uint32 = {gte: 100}];
140+
141+
// Specifies a list of hash policies to use for ring hash load balancing. If ``hash_policy`` is
142+
// set, then
143+
// :ref:`route level hash policy <envoy_v3_api_field_config.route.v3.RouteAction.hash_policy>`
144+
// will be ignored.
145+
repeated config.route.v3.RouteAction.HashPolicy hash_policy = 3;
139146
}

0 commit comments

Comments
 (0)