-
Notifications
You must be signed in to change notification settings - Fork 3.9k
xds: add more route matching types in converted Route data structure #7031
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
xds: add more route matching types in converted Route data structure #7031
Conversation
@@ -342,7 +425,6 @@ public String toString() { | |||
/** See corresponding Envoy proto message {@link io.envoyproxy.envoy.api.v2.route.Route}. */ | |||
static final class Route { | |||
private final RouteMatch routeMatch; | |||
@Nullable |
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.
Justification: a valid Route
should always have a valid matcher and a valid action.
I added logic to validate if the regex string is legal when converting the proto. The compiled |
…taException, as it's used internally.
&& Objects.equals(pathSafeRegExMatch, that.pathSafeRegExMatch) | ||
&& Objects.equals( | ||
pathSafeRegExMatch == null ? null : pathSafeRegExMatch.pattern(), | ||
that.pathSafeRegExMatch == null ? null : that.pathSafeRegExMatch.pattern()) |
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.
Equal objects must have equal hashCode.
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.
Fixed. Good catch. Thanks.
…rpc#7031) Parse other matcher types (e.g., header matchers, runtime fraction matchers, etc) that xDS Route supports.
null
in converted objects for unset fields in proto messages. This puts a much stronger/clearer signal for proto'soneof
type.Most conversion logic and tests are trivial. But the way we represent data and perform checks matters.