-
Notifications
You must be signed in to change notification settings - Fork 4k
xds: Add composite filter #12646
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
base: master
Are you sure you want to change the base?
xds: Add composite filter #12646
Changes from all commits
603d4fe
cd6c611
64e7c1c
10c8d1e
0648217
1d4d18e
4d2f442
af9a9ce
be05900
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,7 @@ static FilterChain parseFilterChain( | |
| // FilterChain contains L4 filters, so we ensure it contains only HCM. | ||
| if (proto.getFiltersCount() != 1) { | ||
| throw new ResourceInvalidException("FilterChain " + filterChainName | ||
| + " should contain exact one HttpConnectionManager filter"); | ||
| + " should contain exactly one HttpConnectionManager filter"); | ||
|
Collaborator
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. nit: Okay for now. But it's usually better to move small unrelated changes into a separate PR. |
||
| } | ||
| io.envoyproxy.envoy.config.listener.v3.Filter l4Filter = proto.getFiltersList().get(0); | ||
| if (!l4Filter.hasTypedConfig()) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,13 +91,39 @@ public static Matchers.StringMatcher parseStringMatcher( | |
| Pattern.compile(proto.getSafeRegex().getRegex())); | ||
| case CONTAINS: | ||
| return Matchers.StringMatcher.forContains(proto.getContains()); | ||
| case CUSTOM: | ||
| throw new IllegalArgumentException("custom string matcher is not supported"); | ||
| case MATCHPATTERN_NOT_SET: | ||
| default: | ||
| throw new IllegalArgumentException( | ||
| "Unknown StringMatcher match pattern: " + proto.getMatchPatternCase()); | ||
| } | ||
| } | ||
|
|
||
| /** Translate StringMatcher xDS proto to internal StringMatcher. */ | ||
| public static Matchers.StringMatcher parseStringMatcher( | ||
|
Member
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. The stringMatcher parsing logic should not be in this PR. It will be covered by A106. You then need to just modify add the |
||
| com.github.xds.type.matcher.v3.StringMatcher proto) { | ||
| switch (proto.getMatchPatternCase()) { | ||
| case EXACT: | ||
| return Matchers.StringMatcher.forExact(proto.getExact(), proto.getIgnoreCase()); | ||
| case PREFIX: | ||
| return Matchers.StringMatcher.forPrefix(proto.getPrefix(), proto.getIgnoreCase()); | ||
| case SUFFIX: | ||
| return Matchers.StringMatcher.forSuffix(proto.getSuffix(), proto.getIgnoreCase()); | ||
| case SAFE_REGEX: | ||
| return Matchers.StringMatcher.forSafeRegEx( | ||
| Pattern.compile(proto.getSafeRegex().getRegex())); | ||
| case CONTAINS: | ||
| return Matchers.StringMatcher.forContains(proto.getContains()); | ||
| case CUSTOM: | ||
| throw new IllegalArgumentException("custom string matcher is not supported"); | ||
| case MATCHPATTERN_NOT_SET: | ||
| default: | ||
| throw new IllegalArgumentException( | ||
| "Unknown StringMatcher match pattern: " + proto.getMatchPatternCase()); | ||
| } | ||
| } | ||
|
|
||
| /** Translates envoy proto FractionalPercent to internal FractionMatcher. */ | ||
| public static Matchers.FractionMatcher parseFractionMatcher( | ||
| io.envoyproxy.envoy.type.v3.FractionalPercent proto) { | ||
|
|
||
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.
go/java-practices/null#collection
Is there a semantic difference between a null
filterMetadataand emptyfilterMetadata?