matchers: add server name xds matcher#20652
Conversation
Signed-off-by: Kuat Yessenov <kuat@google.com>
|
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to |
| namespace Common { | ||
| namespace Matcher { | ||
|
|
||
| class NetworkTrieMatcherFactory : public TrieMatcherFactoryBase<Network::MatchingData> {}; |
There was a problem hiding this comment.
Why should these class definitions be moved to .cc?
There was a problem hiding this comment.
For consistency. It doesn't seem to be useful to export these in a header.
lambdai
left a comment
There was a problem hiding this comment.
Generally LGTM. I didn't look into the scary match...
| .. _extension_envoy.matching.custom_matchers.domain_matcher: | ||
|
|
||
| * :ref:`Server name matcher <envoy_v3_api_msg_.xds.type.matcher.v3.ServerNameMatcher>`. |
There was a problem hiding this comment.
Can you clarify that this matcher is supposed to match SNI?
Particularly, the wildcard matcher does not apply to wildcard cert "*.example.com"
There was a problem hiding this comment.
It is not only SNI, it would work for virtual host as well. I'll make it clear that it matches domains, not wildcards.
There was a problem hiding this comment.
Aha, yes, virtual host can reuse this matcher!
| typed_config: | ||
| "@type": type.googleapis.com/google.protobuf.StringValue | ||
| custom_match: | ||
| name: ip_matcher |
There was a problem hiding this comment.
server_name_matcher and below :)
| using ::Envoy::Matcher::OnMatch; | ||
|
|
||
| /** | ||
| * A "compressed" trie node with domain parts as edge values. |
There was a problem hiding this comment.
What does compress mean? Can two parts be compressed in a single node?
There was a problem hiding this comment.
Compressed as in it's not a regular trie with letters as alphabet. It doesn't compress two domain parts. Added a little diagram.
| .. _extension_envoy.matching.custom_matchers.domain_matcher: | ||
|
|
||
| * :ref:`Server name matcher <envoy_v3_api_msg_.xds.type.matcher.v3.ServerNameMatcher>`. |
There was a problem hiding this comment.
Aha, yes, virtual host can reuse this matcher!
| } | ||
| if (matched.match_state_ == MatchState::MatchComplete && matched.result_) { | ||
| return {MatchState::MatchComplete, OnMatch<DataType>{matched.result_, nullptr}}; | ||
| } |
There was a problem hiding this comment.
Is it possible to escape the if (on_match) { block w/o return ?
In which case?
If the answer is yes, should on_match degrade from exact_on_match to prefix_on_match ?
There was a problem hiding this comment.
Yes, it can have nested matchers so the match can complete without a result.
It does degrade, because it traverses the parent_prefix_ edges. E.g. it'll try wider and wider patters by going from the node to the root.
Signed-off-by: Kuat Yessenov <kuat@google.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
ping @phlax |
phlax
left a comment
There was a problem hiding this comment.
this lgtm, but its a bit outside my competence to land
@mattklein123 can i pass this over to you as a CODEOWNER
mattklein123
left a comment
There was a problem hiding this comment.
Thanks at a high level LGTM to ship and iterate. A few small doc comments:
- Please add a release note
- Can you add an example somewhere so people have something to crib from?
Thank you!
/wait
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
Still want to get this done... |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Commit Message: Implements server name matcher in Envoy, as needed by the listener unified matcher for matching SNI.
Additional Description:
Risk Level: low
Testing: unit
Docs Changes: yes
Release Notes: no