thrift_proxy: add service name matching to router implementation (#4130)

Currently, the thrift router only supports method matching as a way to route thrift requests. This builds on that by adding the ability to specify a service name that is used when matching. This change updates the RouteMatch proto definition to use a oneof field to indicate what type of matching should be done, as well as an invert flag that will allow for inverse matching rules.

Additionally:
* ensure new RouteEntryImplBase implementations check that inversion and wildcard matching are not enabled at the same time, as this would result in no matches for a route
* implement service matching as checking the prefix of the method name, as that's how it's implemented in thrift

*Risk Level:* Low
*Testing:*
* new and existing unit tests pass.
* updated integration test use new matching rules and ensure that expected upstreams receive requests.
*Documentation:* n/a
*Release Notes:* n/a

Signed-off-by: Brian Ramos <brirams@users.noreply.github.com>

Mirrored from https://github.com/envoyproxy/envoy @ 27fb1d353bb13d778a7fb70186e77ad7ce1080e1
pull/620/head
data-plane-api(CircleCI) 7 years ago
parent 77d13eacf7
commit 34928fe3ad
  1. 21
      envoy/config/filter/network/thrift_proxy/v2alpha1/route.proto

@ -27,11 +27,24 @@ message Route {
RouteAction route = 2 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
}
// [#comment:next free field: 2]
// [#comment:next free field: 4]
message RouteMatch {
// If specified, the route must exactly match the request method name. As a special case, an
// empty string matches any request method name.
string method = 1;
oneof match_specifier {
option (validate.required) = true;
// If specified, the route must exactly match the request method name. As a special case, an
// empty string matches any request method name.
string method_name = 1;
// If specified, the route must have the service name as the request method name prefix. As a
// special case, an empty string matches any service name. Only relevant when service
// multiplexing.
string service_name = 2;
}
// Inverts whatever matching is done in match_specifier. Cannot be combined with wildcard matching
// as that would result in routes never being matched.
bool invert = 3;
}
// [#comment:next free field: 2]

Loading…
Cancel
Save