dubbo_proxy: Adds a routing matcher for the Dubbo protocol. (#5571)

*Description*: Adds a routing matcher for the Dubbo protocol. #3998
*Risk Level*: low
*Testing*: unit test
*Docs Changes*: N/A
*Release Notes*: N/A

this is only part of the code for DubboProxy, the rest of the code hasn't been committed yet, complete implementation: https://github.com/gengleilei/envoy/tree/feature-dubbo-router-develop/source/extensions/filters/network/dubbo_proxy

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

Mirrored from https://github.com/envoyproxy/envoy @ 57b19820c8cc3b3eb84bc0e372dc056aa29d472f
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 40afd47af0
commit 77142859a6
  1. 11
      envoy/config/filter/network/dubbo_proxy/v2alpha1/BUILD
  2. 39
      envoy/config/filter/network/dubbo_proxy/v2alpha1/dubbo_proxy.proto
  3. 103
      envoy/config/filter/network/dubbo_proxy/v2alpha1/route.proto

@ -4,5 +4,14 @@ licenses(["notice"]) # Apache 2
api_proto_library(
name = "dubbo_proxy",
srcs = ["dubbo_proxy.proto"],
srcs = [
"dubbo_proxy.proto",
"route.proto",
],
deps = [
"//envoy/api/v2/core:base",
"//envoy/api/v2/route",
"//envoy/type:range",
"//envoy/type/matcher:string",
],
)

@ -1,27 +1,54 @@
syntax = "proto3";
package envoy.extensions.filters.network.dubbo_proxy.v2alpha1;
option java_package = "io.envoyproxy.envoy.extensions.filters.network.dubbo_proxy.v2alpha1";
package envoy.config.filter.network.dubbo_proxy.v2alpha1;
option java_package = "io.envoyproxy.envoy.config.filter.network.dubbo_proxy.v2alpha1";
option go_package = "v2";
import "envoy/config/filter/network/dubbo_proxy/v2alpha1/route.proto";
import "google/protobuf/any.proto";
import "validate/validate.proto";
import "gogoproto/gogo.proto";
// [#protodoc-title: Dubbo Proxy]
// Dubbo Proxy filter configuration.
message DubboProxy {
// The human readable prefix to use when emitting statistics.
string stat_prefix = 1 [(validate.rules).string.min_bytes = 1];
// Configure the protocol used.
ProtocolType protocol_type = 2 [(validate.rules).enum.defined_only = true];
// Configure the serialization protocol used.
SerializationType serialization_type = 3 [(validate.rules).enum.defined_only = true];
// The route table for the connection manager is static and is specified in this property.
repeated RouteConfiguration route_config = 4;
// A list of individual Dubbo filters that make up the filter chain for requests made to the
// Dubbo proxy. Order matters as the filters are processed sequentially. For backwards
// compatibility, if no dubbo_filters are specified, a default Dubbo router filter
// (`envoy.filters.dubbo.router`) is used.
repeated DubboFilter dubbo_filters = 5;
}
enum ProtocolType {
Dubbo = 0; // the default protocol.
}
ProtocolType protocol_type = 2 [(validate.rules).enum.defined_only = true];
// Configure the serialization protocol used.
enum SerializationType {
Hessian2 = 0; // the default serialization protocol.
}
SerializationType serialization_type = 3 [(validate.rules).enum.defined_only = true];
// DubboFilter configures a Dubbo filter.
// [#comment:next free field: 3]
message DubboFilter {
// The name of the filter to instantiate. The name must match a supported
// filter.
string name = 1 [(validate.rules).string.min_bytes = 1];
// Filter specific configuration which depends on the filter being
// instantiated. See the supported filters for further documentation.
google.protobuf.Any config = 2;
}

@ -0,0 +1,103 @@
syntax = "proto3";
package envoy.config.filter.network.dubbo_proxy.v2alpha1;
option java_package = "io.envoyproxy.envoy.config.filter.network.dubbo_proxy.v2alpha1";
option go_package = "v2";
import "envoy/api/v2/route/route.proto";
import "envoy/type/matcher/string.proto";
import "envoy/type/range.proto";
import "google/protobuf/wrappers.proto";
import "validate/validate.proto";
import "gogoproto/gogo.proto";
// [#protodoc-title: Dubbo route configuration]
message RouteConfiguration {
// The name of the route configuration. Reserved for future use in asynchronous route discovery.
string name = 1;
// The interface name of the service.
string interface = 2;
// Which group does the interface belong to.
string group = 3;
// The version number of the interface.
string version = 4;
// The list of routes that will be matched, in order, against incoming requests. The first route
// that matches will be used.
repeated Route routes = 5 [(gogoproto.nullable) = false];
}
message Route {
// Route matching prarameters.
RouteMatch match = 1 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
// Route request to some upstream cluster.
RouteAction route = 2 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
}
message MethodMatch {
// The name of the method.
envoy.type.matcher.StringMatcher name = 1;
// The parameter matching type.
message ParameterMatchSpecifier {
oneof parameter_match_specifier {
// If specified, header match will be performed based on the value of the header.
string exact_match = 3;
// If specified, header match will be performed based on range.
// The rule will match if the request header value is within this range.
// The entire request header value must represent an integer in base 10 notation: consisting
// of an optional plus or minus sign followed by a sequence of digits. The rule will not match
// if the header value does not represent an integer. Match will fail for empty values,
// floating point numbers or if only a subsequence of the header value is an integer.
//
// Examples:
//
// * For range [-10,0), route will match for header value -1, but not for 0,
// "somestring", 10.9,
// "-1somestring"
envoy.type.Int64Range range_match = 4;
}
}
// Method parameter definition.
// The key is the parameter index, starting from 0.
// 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