Skip to content

Commit 5388b9f

Browse files
router: complete the new matcher based cluster specifier (#39816)
Commit Message: router: complete the new matcher based cluster specifier Additional Description: Now we can specifiy multiple clusters in single route and select different cluster based on the request attributes. This is an independent new feature but also is pre PR of [#38859](envoyproxy/envoy#38859). Risk Level: low, new extension. Testing: unit. Docs Changes: added. Release Notes: added. --------- Signed-off-by: wangbaiping(wbpcode) <[email protected]> Signed-off-by: code <[email protected]> Co-authored-by: Rohit Agrawal <[email protected]> Mirrored from https://github.com/envoyproxy/envoy @ f19cadd4ead6166cc22b5d225d4719e25e50be45
1 parent b2e74d7 commit 5388b9f

File tree

1 file changed

+51
-1
lines changed
  • envoy/extensions/router/cluster_specifiers/matcher/v3

1 file changed

+51
-1
lines changed

envoy/extensions/router/cluster_specifiers/matcher/v3/matcher.proto

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,61 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
1515

1616
// [#protodoc-title: Matcher Based Cluster Specifier]
1717
// [#extension: envoy.router.cluster_specifier_plugin.matcher]
18-
// [#not-implemented-hide:]
18+
19+
message ClusterAction {
20+
// Indicates the upstream cluster to which the request should be routed
21+
// to.
22+
string cluster = 1 [(validate.rules).string = {min_len: 1}];
23+
}
1924

2025
message MatcherClusterSpecifier {
2126
// The matcher for cluster selection after the route has been selected. This is used when the
2227
// route has multiple clusters (like multiple clusters for different users) and the matcher
2328
// is used to select the cluster to use for the request.
29+
//
30+
// The match tree to use for grouping incoming requests into buckets.
31+
//
32+
// Example:
33+
//
34+
// .. validated-code-block:: yaml
35+
// :type-name: xds.type.matcher.v3.Matcher
36+
//
37+
// matcher_list:
38+
// matchers:
39+
// - predicate:
40+
// single_predicate:
41+
// input:
42+
// typed_config:
43+
// '@type': type.googleapis.com/envoy.type.matcher.v3.HttpRequestHeaderMatchInput
44+
// header_name: env
45+
// value_match:
46+
// exact: staging
47+
// on_match:
48+
// action:
49+
// typed_config:
50+
// '@type': type.googleapis.com/envoy.extensions.router.cluster_specifiers.matcher.v3.ClusterAction
51+
// cluster: "staging-cluster"
52+
//
53+
// - predicate:
54+
// single_predicate:
55+
// input:
56+
// typed_config:
57+
// '@type': type.googleapis.com/envoy.type.matcher.v3.HttpRequestHeaderMatchInput
58+
// header_name: env
59+
// value_match:
60+
// exact: prod
61+
// on_match:
62+
// action:
63+
// typed_config:
64+
// '@type': type.googleapis.com/envoy.extensions.router.cluster_specifiers.matcher.v3.ClusterAction
65+
// cluster: "prod-cluster"
66+
//
67+
// # Catch-all with a default cluster.
68+
// on_no_match:
69+
// action:
70+
// typed_config:
71+
// '@type': type.googleapis.com/envoy.extensions.router.cluster_specifiers.matcher.v3.ClusterAction
72+
// cluster: "default-cluster"
73+
//
2474
xds.type.matcher.v3.Matcher cluster_matcher = 1 [(validate.rules).message = {required: true}];
2575
}

0 commit comments

Comments
 (0)