dubbo_proxy: Refactor the DubboProxy filter (#6410)

Description: Refactor the DubboProxy filter
Risk Level: low
Testing: unit test
Docs Changes: inline
Release Notes: add routing capabilities for the Dubbo protocol

Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>

Mirrored from https://github.com/envoyproxy/envoy @ db7f12427ffedebba5891e724f2ef39d3405c81e
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 71f6c92ed2
commit fea83fbf10
  1. 2
      docs/BUILD
  2. 4
      envoy/config/filter/network/dubbo_proxy/v2alpha1/BUILD
  3. 6
      envoy/config/filter/network/dubbo_proxy/v2alpha1/dubbo_proxy.proto
  4. 66
      envoy/config/filter/network/dubbo_proxy/v2alpha1/route.proto

@ -35,6 +35,7 @@ proto_library(
"//envoy/config/bootstrap/v2:bootstrap",
"//envoy/config/common/tap/v2alpha:common",
"//envoy/config/filter/accesslog/v2:accesslog",
"//envoy/config/filter/dubbo/router/v2alpha1:router",
"//envoy/config/filter/http/buffer/v2:buffer",
"//envoy/config/filter/http/ext_authz/v2:ext_authz",
"//envoy/config/filter/http/fault/v2:fault",
@ -52,6 +53,7 @@ proto_library(
"//envoy/config/filter/http/transcoder/v2:transcoder",
"//envoy/config/filter/listener/original_src/v2alpha1:original_src",
"//envoy/config/filter/network/client_ssl_auth/v2:client_ssl_auth",
"//envoy/config/filter/network/dubbo_proxy/v2alpha1:dubbo_proxy",
"//envoy/config/filter/network/ext_authz/v2:ext_authz",
"//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager",
"//envoy/config/filter/network/mongo_proxy/v2:mongo_proxy",

@ -1,8 +1,8 @@
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library")
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library_internal")
licenses(["notice"]) # Apache 2
api_proto_library(
api_proto_library_internal(
name = "dubbo_proxy",
srcs = [
"dubbo_proxy.proto",

@ -15,7 +15,9 @@ import "validate/validate.proto";
import "gogoproto/gogo.proto";
// [#protodoc-title: Dubbo Proxy]
// Dubbo Proxy filter configuration.
// Dubbo Proxy :ref:`configuration overview <config_network_filters_dubbo_proxy>`.
// [#comment:next free field: 6]
message DubboProxy {
// The human readable prefix to use when emitting statistics.
string stat_prefix = 1 [(validate.rules).string.min_bytes = 1];
@ -36,10 +38,12 @@ message DubboProxy {
repeated DubboFilter dubbo_filters = 5;
}
// Dubbo Protocol types supported by Envoy.
enum ProtocolType {
Dubbo = 0; // the default protocol.
}
// Dubbo Serialization types supported by Envoy.
enum SerializationType {
Hessian2 = 0; // the default serialization protocol.
}

@ -18,8 +18,10 @@ import "gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
// [#protodoc-title: Dubbo route configuration]
// [#protodoc-title: Dubbo Proxy Route Configuration]
// Dubbo Proxy :ref:`configuration overview <config_network_filters_dubbo_proxy>`.
// [#comment:next free field: 6]
message RouteConfiguration {
// The name of the route configuration. Reserved for future use in asynchronous route discovery.
string name = 1;
@ -38,6 +40,7 @@ message RouteConfiguration {
repeated Route routes = 5 [(gogoproto.nullable) = false];
}
// [#comment:next free field: 3]
message Route {
// Route matching parameters.
RouteMatch match = 1 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
@ -46,6 +49,35 @@ message Route {
RouteAction route = 2 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
}
// [#comment:next free field: 3]
message RouteMatch {
// Method level routing matching.
MethodMatch method = 1;
// Specifies a set of headers that the route should match on. The router will check the requests
// headers against all the specified headers in the route config. A match will happen if all the
// headers in the route are present in the request with the same values (or based on presence if
// the value field is not in the config).
repeated envoy.api.v2.route.HeaderMatcher headers = 2;
}
// [#comment:next free field: 3]
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.
envoy.api.v2.route.WeightedCluster weighted_clusters = 2;
}
}
// [#comment:next free field: 5]
message MethodMatch {
// The name of the method.
envoy.type.matcher.StringMatcher name = 1;
@ -66,8 +98,7 @@ message MethodMatch {
// Examples:
//
// * For range [-10,0), route will match for header value -1, but not for 0,
// "somestring", 10.9,
// "-1somestring"
// "somestring", 10.9, "-1somestring"
envoy.type.Int64Range range_match = 4;
}
}
@ -77,32 +108,3 @@ message MethodMatch {
// The value is the parameter matching type.
map<uint32, ParameterMatchSpecifier> params_match = 2;
}
message RouteMatch {
// Method level routing matching.
MethodMatch method = 1;
// Specifies a set of headers that the route should match on. The router will check the requests
// headers against all the specified headers in the route config. A match will happen if all the
// headers in the route are present in the request with the same values (or based on presence if
// the value field is not in the config).
repeated envoy.api.v2.route.HeaderMatcher headers = 2;
}
// [#comment:next free field: 2]
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.
//
// .. note::
// Currently ClusterWeight only supports the name and weight fields.
envoy.api.v2.route.WeightedCluster weighted_clusters = 2;
}
}

Loading…
Cancel
Save