-
Notifications
You must be signed in to change notification settings - Fork 5.5k
router: integrate matching API #17633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 36 commits
12ea8c9
44e162b
7c35634
0586cb1
50fe3e8
81aa2bc
7ff4d44
7acbde0
98100c7
fd00924
28bf418
f4a6292
a4b752b
41f07e4
ba371e8
0fb80ba
9d24e1f
f6d9af7
da0454b
02dc3f0
853a1bd
54079e5
7863b17
4ebb008
09c782e
199a8b1
73e1848
4c9f5e6
aae8d46
2381d38
6e5177e
0071dc8
2de2fa8
fe81ce1
90d687f
90e2332
921dcdd
6863442
0704e32
f75e539
9eedbd5
b31ef7a
2c2be12
082376d
c3149c4
82a5fdd
269954c
8083421
418a270
9d72842
694d945
50080bd
a95c67c
1d16eba
71c4c5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,3 +192,59 @@ upon configuration load and cache the contents. | |
|
|
||
| If **response_headers_to_add** has been set for the Route or the enclosing Virtual Host, | ||
| Envoy will include the specified headers in the direct HTTP response. | ||
|
|
||
| Routing Via Generic Matching | ||
| ---------------------------- | ||
|
|
||
| Envoy recently added support for utilzing a :ref:`generic match tree <envoy_v3_api_msg_config>` to | ||
| specify the route table. This is a more expressive matching engine than the original one, allowing | ||
| for sublinear matching on arbitrary headers (unlike the original matching engine which could only | ||
| do this for :authority in some cases). | ||
|
|
||
| To use the generic matching tree, specify a ref:`matcher <fds>` on a virtual host with a RouteAction action: | ||
|
|
||
| ``` | ||
| matcher: | ||
| "@type": type.googleapis.com/envoy.config.common.matcher.v3.Matcher | ||
| matcher_tree: | ||
| input: | ||
| name: request-headers | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.type.matcher.v3.HttpRequestHeaderMatchInput | ||
| header_name: :path | ||
| exact_match_map: | ||
| map: | ||
| "/new_endpoint/foo": | ||
| action: | ||
| name: route | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.config.route.v3.Route | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broadly agree this structure looks great. One observation I have is that making So, what is here is fine. Maybe you could actually run the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that using Another option would be to copy the common route fields into a |
||
| route: | ||
| cluster: cluster_foo | ||
| request_headers_to_add: | ||
| - header: | ||
| key: x-route-header | ||
| value: new-value | ||
| "/new_endpoint/bar": | ||
| action: | ||
| name: route | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.config.route.v3.Route | ||
| route: | ||
| cluster: cluster_bar | ||
| request_headers_to_add: | ||
| - header: | ||
| key: x-route-header | ||
| value: new-value | ||
| ``` | ||
|
|
||
| This allows resolving the same Route proto message used for the `routes`-based routing using the additional | ||
| matching flexibility provided by the generic matching framework. | ||
|
|
||
| The only inputs supported are request headers (via `envoy.type.matcher.v3.HttpRequestHeaderMatchInput`). See | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this validated and what error message does the user get if they configure something else accidentally? Same question about the action config which I guess will only currently work for route proto lookup?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this was not validated, now we are with the following error message: For action configs the only registered factory for |
||
| the docs for the :ref:`matching API <arch_overview_matching_api>` for more information about the API as a whole. | ||
|
|
||
| Known limiations: | ||
| - The matching tree doesn't work with path rewrites. This is because this relies on rewriting the matched path | ||
| against the rewrite rule, but the matching engine allows matching on :path in many different ways, making it | ||
| ambiguous which path match should be used when rewriting. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for documentation purposes can you add the "upgrade to oneof in next major version" tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that these two fields should move inside of a oneof in the next version. Unfortunately, a repeated field can't be inside of a oneof, so while we can add that annotation to this field, I don't think we can add it to the existing
routesfield. We'll probably need a[#next-major-version]comment instead.