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 @ 51c0d6f47c98087c7e3288205cbf8edf50ae0196
pull/626/head
data-plane-api(Azure Pipelines) 2 years ago
parent 5af1136855
commit dc427e360c
  1. 6
      BUILD
  2. 1
      contrib/envoy/extensions/filters/network/generic_proxy/action/v3/BUILD
  3. 20
      contrib/envoy/extensions/filters/network/generic_proxy/action/v3/action.proto
  4. 0
      contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3/BUILD
  5. 11
      contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3/matcher.proto
  6. 12
      contrib/envoy/extensions/filters/network/generic_proxy/router/v3/BUILD
  7. 19
      contrib/envoy/extensions/filters/network/generic_proxy/router/v3/router.proto
  8. 0
      contrib/envoy/extensions/filters/network/generic_proxy/v3/BUILD
  9. 59
      contrib/envoy/extensions/filters/network/generic_proxy/v3/generic_proxy.proto
  10. 72
      contrib/envoy/extensions/filters/network/generic_proxy/v3/route.proto
  11. 66
      envoy/extensions/filters/network/meta_protocol_proxy/v3/meta_protocol_proxy.proto
  12. 70
      envoy/extensions/filters/network/meta_protocol_proxy/v3/route.proto
  13. 7
      versioning/BUILD

@ -77,6 +77,9 @@ proto_library(
"//contrib/envoy/extensions/filters/http/squash/v3:pkg",
"//contrib/envoy/extensions/filters/http/sxg/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/client_ssl_auth/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/action/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/v3:pkg",
"//contrib/envoy/extensions/filters/network/kafka_broker/v3:pkg",
"//contrib/envoy/extensions/filters/network/kafka_mesh/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/mysql_proxy/v3:pkg",
@ -204,9 +207,6 @@ proto_library(
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
"//envoy/extensions/filters/network/http_connection_manager/v3:pkg",
"//envoy/extensions/filters/network/local_ratelimit/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/action/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/v3:pkg",
"//envoy/extensions/filters/network/mongo_proxy/v3:pkg",
"//envoy/extensions/filters/network/ratelimit/v3:pkg",
"//envoy/extensions/filters/network/rbac/v3:pkg",

@ -6,6 +6,7 @@ licenses(["notice"]) # Apache 2
api_proto_package(
deps = [
"//envoy/config/core/v3:pkg",
"//envoy/config/route/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
"@com_github_cncf_udpa//xds/annotations/v3:pkg",

@ -1,25 +1,27 @@
syntax = "proto3";
package envoy.extensions.filters.network.meta_protocol_proxy.matcher.action.v3;
package envoy.extensions.filters.network.generic_proxy.action.v3;
import "envoy/config/core/v3/base.proto";
import "envoy/config/route/v3/route_components.proto";
import "google/protobuf/any.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_package = "io.envoyproxy.envoy.extensions.filters.network.generic_proxy.action.v3";
option java_outer_classname = "ActionProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/meta_protocol_proxy/matcher/action/v3;actionv3";
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/generic_proxy/action/v3;actionv3";
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]
// [#protodoc-title: Generic Proxy Route Action Configuration]
// Configuration for the route match action.
// [#not-implemented-hide:]
message RouteAction {
oneof cluster_specifier {
option (validate.required) = true;
@ -27,9 +29,17 @@ message RouteAction {
// Indicates the upstream cluster to which the request should be routed.
string cluster = 1;
// [#not-implemented-hide:]
// 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;
}
// Route metadata.
config.core.v3.Metadata metadata = 3;
// Route level config for L7 generic filters. The key should always be the generic
// filter name.
map<string, google.protobuf.Any> per_filter_config = 4;
}

@ -1,36 +1,33 @@
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 "udpa/annotations/status.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_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 (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
// by the application protocol.
// [#not-implemented-hide:]
message ServiceMatchInput {
}
// 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}];

@ -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}];
}

@ -14,6 +14,10 @@ proto_library(
"//contrib/envoy/extensions/filters/http/squash/v3:pkg",
"//contrib/envoy/extensions/filters/http/sxg/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/client_ssl_auth/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/action/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/router/v3:pkg",
"//contrib/envoy/extensions/filters/network/generic_proxy/v3:pkg",
"//contrib/envoy/extensions/filters/network/kafka_broker/v3:pkg",
"//contrib/envoy/extensions/filters/network/kafka_mesh/v3alpha:pkg",
"//contrib/envoy/extensions/filters/network/mysql_proxy/v3:pkg",
@ -142,9 +146,6 @@ proto_library(
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
"//envoy/extensions/filters/network/http_connection_manager/v3:pkg",
"//envoy/extensions/filters/network/local_ratelimit/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/action/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/matcher/v3:pkg",
"//envoy/extensions/filters/network/meta_protocol_proxy/v3:pkg",
"//envoy/extensions/filters/network/mongo_proxy/v3:pkg",
"//envoy/extensions/filters/network/ratelimit/v3:pkg",
"//envoy/extensions/filters/network/rbac/v3:pkg",

Loading…
Cancel
Save