-
Notifications
You must be signed in to change notification settings - Fork 5.3k
api: MetaProtocol Proxy #18823
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
api: MetaProtocol Proxy #18823
Changes from all commits
41a144b
0067255
71ec328
1ad6b24
7b00d7d
38b6124
205ac0f
387ecb2
5dfdc72
5a49dd5
65cd35d
de25039
e3aa02d
dfb16ec
ff3c2b6
0e8e9c0
851923d
57020f0
0437233
92f0006
3ede781
005353c
4d78cac
e6bb0a6
88ce891
b72d0ab
e93277f
e7c33c9
4d415c3
1def61e
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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. | ||
|
|
||
| load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| api_proto_package( | ||
| deps = [ | ||
| "//envoy/config/route/v3:pkg", | ||
| "@com_github_cncf_udpa//udpa/annotations:pkg", | ||
| "@com_github_cncf_udpa//xds/annotations/v3:pkg", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3; | ||
|
|
||
| import "envoy/config/route/v3/route_components.proto"; | ||
|
|
||
| import "xds/annotations/v3/status.proto"; | ||
|
|
||
| import "udpa/annotations/status.proto"; | ||
| import "validate/validate.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3"; | ||
| option java_outer_classname = "ActionProto"; | ||
| option java_multiple_files = true; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
| option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
|
||
| // [#protodoc-title: Meta Protocol Proxy Route Action Configuration] | ||
|
|
||
| // Configuration for the route match action. | ||
| // [#not-implemented-hide:] | ||
| message RouteAction { | ||
| oneof cluster_specifier { | ||
| option (validate.required) = true; | ||
|
|
||
| // Indicates the upstream cluster to which the request should be routed. | ||
| string cluster = 1; | ||
|
|
||
| // Multiple upstream clusters can be specified for a given route. The request is routed to one | ||
| // of the upstream clusters based on weights assigned to each cluster. | ||
| // Currently ClusterWeight only supports the name and weight fields. | ||
| config.route.v3.WeightedCluster weighted_clusters = 2; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. | ||
|
|
||
| load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| api_proto_package( | ||
| deps = [ | ||
| "@com_github_cncf_udpa//udpa/annotations:pkg", | ||
| "@com_github_cncf_udpa//xds/annotations/v3:pkg", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3; | ||
|
|
||
| import "xds/annotations/v3/status.proto"; | ||
|
|
||
| import "udpa/annotations/status.proto"; | ||
| import "validate/validate.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3"; | ||
| option java_outer_classname = "MatcherProto"; | ||
| option java_multiple_files = true; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
| option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
|
||
| // [#protodoc-title: Meta Protocol Proxy Route Matcher Configuration] | ||
|
|
||
| // Used to match request service of the downstream request. Only applicable if a service provided | ||
| // by the application protocol. | ||
| // [#not-implemented-hide:] | ||
| message ServiceMatchInput { | ||
|
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. Are service and method just special properties that we think are common enough to have specific types? Or is there something else that makes them special? I would probably have the comment be a bit more vague here if they are just special properties, like
Member
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. @snowp your concern is legitimate, not every RPC protocol has these two properties. |
||
| } | ||
|
|
||
| // Used to match request method of the downstream request. Only applicable if a method provided | ||
| // by the application protocol. | ||
| // [#not-implemented-hide:] | ||
| message MethodMatchInput { | ||
| } | ||
|
|
||
| // Used to match an arbitrary property of the downstream request. | ||
| // These properties are populated by the codecs of application protocols. | ||
| // [#not-implemented-hide:] | ||
| message PropertyMatchInput { | ||
| // The property name to match on. | ||
| string property_name = 1 [(validate.rules).string = {min_len: 1}]; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. | ||
|
|
||
| load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| api_proto_package( | ||
| deps = [ | ||
| "//envoy/config/core/v3:pkg", | ||
| "@com_github_cncf_udpa//udpa/annotations:pkg", | ||
| "@com_github_cncf_udpa//xds/annotations/v3:pkg", | ||
| "@com_github_cncf_udpa//xds/type/matcher/v3:pkg", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.extensions.filters.network.meta_protocol_proxy.v3; | ||
|
|
||
| import "envoy/config/core/v3/config_source.proto"; | ||
| import "envoy/config/core/v3/extension.proto"; | ||
| import "envoy/extensions/filters/network/meta_protocol_proxy/v3/route.proto"; | ||
|
|
||
| import "xds/annotations/v3/status.proto"; | ||
|
|
||
| import "udpa/annotations/status.proto"; | ||
| import "validate/validate.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.v3"; | ||
| option java_outer_classname = "MetaProtocolProxyProto"; | ||
| option java_multiple_files = true; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
| option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
|
||
| // [#protodoc-title: Meta Protocol Proxy] | ||
| // Meta Protocol proxy. | ||
|
|
||
| // [#not-implemented-hide:] | ||
| // [#next-free-field: 6] | ||
| message MetaProtocolProxy { | ||
| // The human readable prefix to use when emitting statistics. | ||
| string stat_prefix = 1 [(validate.rules).string = {min_len: 1}]; | ||
|
|
||
| // The application protocol built on top of the meta protocol proxy. | ||
| ApplicationProtocol application_protocol = 2 [(validate.rules).message = {required: true}]; | ||
|
|
||
| oneof route_specifier { | ||
| option (validate.required) = true; | ||
|
|
||
| // The meta protocol proxies route table will be dynamically loaded via the meta RDS API. | ||
| MetaRds rds = 3; | ||
|
|
||
| // The route table for the meta protocol proxy is static and is specified in this property. | ||
|
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. You could potentially put examples here, or in the proto docs for RouteConfiguration.
Member
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. An example of the meta protocol route configuration with matcher API has been added to the route.proto. |
||
| RouteConfiguration route_config = 4; | ||
| } | ||
|
|
||
| // A list of individual Layer-7 filters that make up the filter chain for requests made to the | ||
| // meta protocol proxy. Order matters as the filters are processed sequentially as request events | ||
| // happen. | ||
| repeated config.core.v3.TypedExtensionConfig meta_protocol_filters = 5; | ||
| } | ||
|
|
||
| // [#not-implemented-hide:] | ||
| message ApplicationProtocol { | ||
| // The name of the application protocol. | ||
| string name = 1 [(validate.rules).string = {min_len: 1}]; | ||
|
|
||
| // The codec which encodes and decodes the application protocol. | ||
| config.core.v3.TypedExtensionConfig codec = 2 [(validate.rules).message = {required: true}]; | ||
| } | ||
|
|
||
| // [#not-implemented-hide:] | ||
| message MetaRds { | ||
| // Configuration source specifier for RDS. | ||
| config.core.v3.ConfigSource config_source = 1 [(validate.rules).message = {required: true}]; | ||
|
|
||
| // The name of the route configuration. This name will be passed to the RDS API. This allows an | ||
| // Envoy configuration with multiple meta protocol proxies to use different route configurations. | ||
| string route_config_name = 2 [(validate.rules).string = {min_len: 1}]; | ||
| } | ||
|
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. This should all be
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. get it.
Member
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. fixed |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.extensions.filters.network.meta_protocol_proxy.v3; | ||
|
|
||
| import "xds/annotations/v3/status.proto"; | ||
| import "xds/type/matcher/v3/matcher.proto"; | ||
|
|
||
| import "udpa/annotations/status.proto"; | ||
| import "validate/validate.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.v3"; | ||
| option java_outer_classname = "RouteProto"; | ||
| option java_multiple_files = true; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
| option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
|
||
| // [#protodoc-title: Meta Protocol Proxy Route Configuration] | ||
| // The meta protocol proxy makes use of the `xds matching API` for routing configurations. | ||
| // | ||
| // In the below example, we combine a top level tree matcher with a linear matcher to match | ||
| // the incoming requests, and send the matching requests to v1 of the upstream service. | ||
| // | ||
| // name: demo-v1 | ||
| // route: | ||
| // matcher_tree: | ||
| // input: | ||
| // name: request-service | ||
| // typed_config: | ||
| // "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3.ServiceMatchInput | ||
| // exact_match_map: | ||
| // map: | ||
| // org.apache.dubbo.samples.basic.api.DemoService: | ||
| // matcher: | ||
| // matcher_list: | ||
| // matchers: | ||
| // - predicate: | ||
| // and_matcher: | ||
| // predicate: | ||
| // - single_predicate: | ||
| // input: | ||
| // name: request-properties | ||
| // typed_config: | ||
| // "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3.PropertyMatchInput | ||
| // property_name: version | ||
| // value_match: | ||
| // exact: v1 | ||
| // - single_predicate: | ||
| // input: | ||
| // name: request-properties | ||
| // typed_config: | ||
| // "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3.PropertyMatchInput | ||
| // property_name: user | ||
| // value_match: | ||
| // exact: john | ||
| // on_match: | ||
| // action: | ||
| // name: route | ||
| // typed_config: | ||
| // "@type": type.googleapis.com/envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3.routeAction | ||
| // cluster: outbound|20880|v1|org.apache.dubbo.samples.basic.api.demoservice | ||
| // [#not-implemented-hide:] | ||
| message RouteConfiguration { | ||
| // The name of the route configuration. For example, it might match route_config_name in | ||
| // envoy.extensions.filters.network.meta_protocol_proxy.v3.Rds. | ||
| string name = 1 [(validate.rules).string = {min_len: 1}]; | ||
|
|
||
| // The match tree to use when resolving route actions for incoming requests. | ||
| xds.type.matcher.v3.Matcher route = 2 [(validate.rules).message = {required: true}]; | ||
|
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. Nice to see the switch to this (CC @snowp). Have you a working implementation yet based on these matchers? Any reference PR with all the pieces connected together? In general the strategy of small incremental PRs is good, but it's also good to have some branch or PR to refer to that connects this.
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. Thanks. We have implemented part of it and plan to submit a new PR after the API is merged. All progress and PR will be recorded in #18209. |
||
| } | ||
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.
What's the long term plan here? How much of the existing
RouteActionin RDS will be reproduced? If it's the entire thing, then arguably we should just augment existingRouteActionwith the ability to match on MetaProtocol attributes (maybe it can already via dynamic metadata matchers?). If not, we should be clear on the long term relationship across these structures.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.
We will check it.
Uh oh!
There was an error while loading. Please reload this page.
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.
@htuch @wbpcode
I had the same thought about that: should we reuse the existing RouteAction? Or create another similar one?
My concern is the existing RouteAction is highly coupled with the HTTP protocol. If we reuse it, some properties and inner structures may become too ambiguous or useless for the MetaProtocol.
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.
@zhaohuabing I think so too. May be we should create new RouteAction which is protocol-independent for the meta protocol proxy. cc @htuch
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 it's not great to have the duplication, but I would be OK starting from scratch and making sure we don't have ambiguity.
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.
https://github.com/cncf/xds/blob/cb28da3451f158a947dfc45090fe92b07b243bc1/xds/type/matcher/v3/matcher.proto#L38-L39
I think different protocols differ on
RouteAction, would it be better if we can provide a public interface similar toactionin the generic matching?Uh oh!
There was an error while loading. Please reload this page.
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.
If it's necessary, we can add new google.protobuf.Any type
custom_protocol_specific_configfield to theRouteActionin the future.