-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
dubbo_proxy: Adds a routing matcher for the Dubbo protocol. #5571
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1f0cffd
Adds a routing matcher for the Dubbo protocol.
gengleilei af379bc
Fixed spelling errors in word parameter.
gengleilei 9ea2792
Delete useless code and add utility.h file.
gengleilei 496b88b
Add unit test cases for wildcards(?).
gengleilei 0b6a7bc
Modify the route.proto and dubbo_proxy.proto definition.
gengleilei 62f8268
Change the method name type to StringMatcher.
gengleilei f66d586
Add validation for the RouteConfiguration rule and remove the useless…
gengleilei bbe4d86
Changed the parameter_router_ type tto shared_ptr.
gengleilei 2ca11f1
Remove "java_multiple_files" declaration from the route.proto file
gengleilei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 36 additions & 9 deletions
45
api/envoy/config/filter/network/dubbo_proxy/v2alpha1/dubbo_proxy.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
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]; | ||
|
||
// 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. | ||
} | ||
|
||
enum SerializationType { | ||
Hessian2 = 0; // the default serialization protocol. | ||
} | ||
|
||
// 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; | ||
} |
103 changes: 103 additions & 0 deletions
103
api/envoy/config/filter/network/dubbo_proxy/v2alpha1/route.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
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. If the type of the parameter is not an integer, is this range matching useful? 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. Sorry, The type definition is not needed. I delete it. |
||
} | ||
} | ||
|
||
// 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 request’s | ||
// 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@gengleilei I am new to dubbo, my question is how to setup
individual Dubbo filters
?I can not find any other supported filters except
envoy.filters.dubbo.router
.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.
You can refer to the Router (router_impl.h), you need to implement DubboFilters: : DecoderFilter interface, yaml configuration is as follows:
stat_prefix: ingress
route_config:
name: local_route
dubbo_filters:
- name: envoy.filters.dubbo.mock_filter
config:
"@type": type.googleapis.com/google.protobuf.Struct
value:
name: test_service
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.
IC, this is for advanced users, need to hack into the envoy code.
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.
The Filter based extension mechanism is similar to HTTP. Dubbo does not define a unique Filter mechanism. of course, if you have good suggestions, we are also very welcome to build together.
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 got this error, any idea?