extension: added generic proxy network filter (#22826)
* initial draft for the meta protocol proxy Signed-off-by: wbpcode <comems@msn.com> * minor update Signed-off-by: wbpcode <comems@msn.com> * add match implemented Signed-off-by: wbpcode <comems@msn.com> * add some simple test Signed-off-by: wbpcode <wbphub@live.com> * add more test for route matcher Signed-off-by: wbpcode <wbphub@live.com> * partial commit Signed-off-by: wbpcode <wbphub@live.com> * complete basic unit test Signed-off-by: wbpcode <comems@msn.com> * fix format Signed-off-by: wbpcode <comems@msn.com> * fix error after merge Signed-off-by: wbpcode <wbphub@live.com> * add some more test Signed-off-by: wbpcode <wbphub@live.com> * minor fix Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix test Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * just make it run Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * just make it run Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * first integration test Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * complete almost all the tests and fix docs and format Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix proto format Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * minor update Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * add cleanup Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * update for clang tidy and type error Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * lower coverage threshould Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix unexpected include Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix window build Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * rename to generic proxy to avoid name conflict Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix docs Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * remove unnecessary readme Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * update comments and name of matcher Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix format Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * add name method Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * move everything to contrib Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * simple release note Signed-off-by: wbpcode <wangbaiping@corp.netease.com> * fix format Signed-off-by: wbpcode <wangbaiping@corp.netease.com> Signed-off-by: wbpcode <comems@msn.com> Signed-off-by: wbpcode <wbphub@live.com> Signed-off-by: wbpcode <wangbaiping@corp.netease.com> Mirrored from https://github.com/envoyproxy/envoy @ 51c0d6f47c98087c7e3288205cbf8edf50ae0196pull/626/head
parent
5af1136855
commit
dc427e360c
13 changed files with 189 additions and 154 deletions
@ -1,36 +1,33 @@ |
|||||||
syntax = "proto3"; |
syntax = "proto3"; |
||||||
|
|
||||||
package envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3; |
package envoy.extensions.filters.network.generic_proxy.matcher.v3; |
||||||
|
|
||||||
import "xds/annotations/v3/status.proto"; |
import "xds/annotations/v3/status.proto"; |
||||||
|
|
||||||
import "udpa/annotations/status.proto"; |
import "udpa/annotations/status.proto"; |
||||||
import "validate/validate.proto"; |
import "validate/validate.proto"; |
||||||
|
|
||||||
option java_package = "io.envoyproxy.envoy.extensions.filters.network.meta_protocol_proxy.matcher.v3"; |
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.matcher.v3"; |
||||||
option java_outer_classname = "MatcherProto"; |
option java_outer_classname = "MatcherProto"; |
||||||
option java_multiple_files = true; |
option java_multiple_files = true; |
||||||
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/meta_protocol_proxy/matcher/v3;matcherv3"; |
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/matcher/v3;matcherv3"; |
||||||
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||||
option (xds.annotations.v3.file_status).work_in_progress = true; |
option (xds.annotations.v3.file_status).work_in_progress = true; |
||||||
|
|
||||||
// [#protodoc-title: Meta Protocol Proxy Route Matcher Configuration] |
// [#protodoc-title: Generic Proxy Route Matcher Configuration] |
||||||
|
|
||||||
// Used to match request service of the downstream request. Only applicable if a service provided |
// Used to match request service of the downstream request. Only applicable if a service provided |
||||||
// by the application protocol. |
// by the application protocol. |
||||||
// [#not-implemented-hide:] |
|
||||||
message ServiceMatchInput { |
message ServiceMatchInput { |
||||||
} |
} |
||||||
|
|
||||||
// Used to match request method of the downstream request. Only applicable if a method provided |
// Used to match request method of the downstream request. Only applicable if a method provided |
||||||
// by the application protocol. |
// by the application protocol. |
||||||
// [#not-implemented-hide:] |
|
||||||
message MethodMatchInput { |
message MethodMatchInput { |
||||||
} |
} |
||||||
|
|
||||||
// Used to match an arbitrary property of the downstream request. |
// Used to match an arbitrary property of the downstream request. |
||||||
// These properties are populated by the codecs of application protocols. |
// These properties are populated by the codecs of application protocols. |
||||||
// [#not-implemented-hide:] |
|
||||||
message PropertyMatchInput { |
message PropertyMatchInput { |
||||||
// The property name to match on. |
// The property name to match on. |
||||||
string property_name = 1 [(validate.rules).string = {min_len: 1}]; |
string property_name = 1 [(validate.rules).string = {min_len: 1}]; |
@ -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", |
||||||
|
], |
||||||
|
) |
@ -0,0 +1,19 @@ |
|||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
package envoy.extensions.filters.network.generic_proxy.router.v3; |
||||||
|
|
||||||
|
import "xds/annotations/v3/status.proto"; |
||||||
|
|
||||||
|
import "udpa/annotations/status.proto"; |
||||||
|
|
||||||
|
option java_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.router.v3"; |
||||||
|
option java_outer_classname = "RouterProto"; |
||||||
|
option java_multiple_files = true; |
||||||
|
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/router/v3;routerv3"; |
||||||
|
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||||
|
option (xds.annotations.v3.file_status).work_in_progress = true; |
||||||
|
|
||||||
|
// [#protodoc-title: Router for generic proxy] |
||||||
|
|
||||||
|
message Router { |
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
package envoy.extensions.filters.network.generic_proxy.v3; |
||||||
|
|
||||||
|
import "contrib/envoy/extensions/filters/network/generic_proxy/v3/route.proto"; |
||||||
|
import "envoy/config/core/v3/config_source.proto"; |
||||||
|
import "envoy/config/core/v3/extension.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.generic_proxy.v3"; |
||||||
|
option java_outer_classname = "GenericProxyProto"; |
||||||
|
option java_multiple_files = true; |
||||||
|
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/v3;generic_proxyv3"; |
||||||
|
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||||
|
option (xds.annotations.v3.file_status).work_in_progress = true; |
||||||
|
|
||||||
|
// [#protodoc-title: Generic Proxy] |
||||||
|
// Generic proxy. |
||||||
|
// [#extension: envoy.filters.network.generic_proxy] |
||||||
|
|
||||||
|
// [#next-free-field: 6] |
||||||
|
message GenericProxy { |
||||||
|
// The human readable prefix to use when emitting statistics. |
||||||
|
string stat_prefix = 1 [(validate.rules).string = {min_len: 1}]; |
||||||
|
|
||||||
|
// The codec which encodes and decodes the application protocol. |
||||||
|
config.core.v3.TypedExtensionConfig codec_config = 2 |
||||||
|
[(validate.rules).message = {required: true}]; |
||||||
|
|
||||||
|
oneof route_specifier { |
||||||
|
option (validate.required) = true; |
||||||
|
|
||||||
|
// [#not-implemented-hide:] |
||||||
|
// The generic proxies route table will be dynamically loaded via the meta RDS API. |
||||||
|
GenericRds generic_rds = 3; |
||||||
|
|
||||||
|
// The route table for the generic proxy is static and is specified in this property. |
||||||
|
RouteConfiguration route_config = 4; |
||||||
|
} |
||||||
|
|
||||||
|
// A list of individual Layer-7 filters that make up the filter chain for requests made to the |
||||||
|
// proxy. Order matters as the filters are processed sequentially as request events |
||||||
|
// happen. |
||||||
|
repeated config.core.v3.TypedExtensionConfig filters = 5; |
||||||
|
} |
||||||
|
|
||||||
|
// [#not-implemented-hide:] |
||||||
|
message GenericRds { |
||||||
|
// 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 generic proxies to use different route configurations. |
||||||
|
string route_config_name = 2 [(validate.rules).string = {min_len: 1}]; |
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
package envoy.extensions.filters.network.generic_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.generic_proxy.v3"; |
||||||
|
option java_outer_classname = "RouteProto"; |
||||||
|
option java_multiple_files = true; |
||||||
|
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/v3;generic_proxyv3"; |
||||||
|
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||||
|
option (xds.annotations.v3.file_status).work_in_progress = true; |
||||||
|
|
||||||
|
// [#protodoc-title: Generic Proxy Route Configuration] |
||||||
|
|
||||||
|
// The generic 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. |
||||||
|
// |
||||||
|
// .. code-block:: yaml |
||||||
|
// |
||||||
|
// name: example |
||||||
|
// routes: |
||||||
|
// matcher_tree: |
||||||
|
// input: |
||||||
|
// name: request-service |
||||||
|
// typed_config: |
||||||
|
// "@type": type.googleapis.com/envoy.extensions.filters.network.generic_proxy.matcher.v3.ServiceMatchInput |
||||||
|
// exact_match_map: |
||||||
|
// map: |
||||||
|
// service_name_0: |
||||||
|
// matcher: |
||||||
|
// matcher_list: |
||||||
|
// matchers: |
||||||
|
// - predicate: |
||||||
|
// and_matcher: |
||||||
|
// predicate: |
||||||
|
// - single_predicate: |
||||||
|
// input: |
||||||
|
// name: request-properties |
||||||
|
// typed_config: |
||||||
|
// "@type": type.googleapis.com/envoy.extensions.filters.network.generic_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.generic_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.generic_proxy.action.v3.routeAction |
||||||
|
// cluster: cluster_0 |
||||||
|
message RouteConfiguration { |
||||||
|
// The name of the route configuration. For example, it might match route_config_name in |
||||||
|
// envoy.extensions.filters.network.generic_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 routes = 2 [(validate.rules).message = {required: true}]; |
||||||
|
} |
@ -1,66 +0,0 @@ |
|||||||
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 go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/meta_protocol_proxy/v3;meta_protocol_proxyv3"; |
|
||||||
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. |
|
||||||
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}]; |
|
||||||
} |
|
@ -1,70 +0,0 @@ |
|||||||
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 go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/meta_protocol_proxy/v3;meta_protocol_proxyv3"; |
|
||||||
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}]; |
|
||||||
} |
|
Loading…
Reference in new issue