thrift router: Support request subset lb#18541
thrift router: Support request subset lb#18541mattklein123 merged 17 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
|
Hi @xiaoma2015, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
|
We need add some tests for this new feature. |
|
/assign |
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for your contributions, and some minor comments are added.
| if (route_entry_has_match) { | ||
| ON_CALL(callbacks_.route_->route_entry_, metadataMatchCriteria()) | ||
| .WillByDefault(Return(&route_entry_matches)); | ||
| } else { | ||
| ON_CALL(callbacks_.route_->route_entry_, metadataMatchCriteria()) | ||
| .WillByDefault(Return(nullptr)); | ||
| } |
There was a problem hiding this comment.
So, where is the verify of metadata match criteria?
There was a problem hiding this comment.
test code coming soon
| if (filter_it != request_metadata.end() && route_criteria != nullptr) { | ||
| metadata_match_criteria_ = route_criteria->mergeMatchCriteria(filter_it->second); | ||
| } else if (filter_it != request_metadata.end()) { | ||
| metadata_match_criteria_ = | ||
| std::make_unique<Envoy::Router::MetadataMatchCriteriaImpl>(filter_it->second); | ||
| } else { | ||
| return route_criteria; | ||
| } |
There was a problem hiding this comment.
May be following form can make this branches more clear:
if (filter_it != request_metadata.end()) {
metadata_match_criteria_ = route_criteria != nullptr ? ... : ...;
// or
// if (route_criteria != nullptr) { .... }
} else {
return route_criteria;
}
source/extensions/filters/network/thrift_proxy/router/router_impl.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
wbpcode
left a comment
There was a problem hiding this comment.
Thanks. Looks great. And add some comments about the line comments.
source/extensions/filters/network/thrift_proxy/router/router_impl.h
Outdated
Show resolved
Hide resolved
| initializeRouter(); | ||
| startRequest(MessageType::Call); | ||
|
|
||
| // Test case for router filter metadata is not empty |
There was a problem hiding this comment.
May be this comment is unnecessary?
| initializeRouter(); | ||
| startRequest(MessageType::Call); | ||
|
|
||
| // Test case for router filter metadata is empty |
There was a problem hiding this comment.
May be this comment is unnecessary?
| verifyMetadataMatchCriteriaFromRoute(true); | ||
| } | ||
|
|
||
| // Test for request metadata is empty |
There was a problem hiding this comment.
May Test the case where both route metadata match criteria and dynamic metadata match criteria are empty. ?
| EXPECT_EQ((*it)->value().value().string_value(), "devel"); | ||
| it++; | ||
|
|
||
| // `version` should be what came from the request, overriding the route entry. |
There was a problem hiding this comment.
May
`version` should be what came from the request and override the route entry's.
?
source/extensions/filters/network/thrift_proxy/router/router_impl.h
Outdated
Show resolved
Hide resolved
| return route_criteria; | ||
| } | ||
|
|
||
| return metadata_match_criteria_.get(); |
There was a problem hiding this comment.
we can simplify this a bit:
if (filter_it == request_metadata.end()) {
return route_criteria;
}
metadata_match_criteria_ = route_criteria != nullptr ? route_criteria->mergeMatchCriteria(filter_it->second) : std::make_unique<Envoy::Router::MetadataMatchCriteriaImpl>(filter_it->second);
return metadata_match_criteria_.get();
There was a problem hiding this comment.
using ifelse is better?
There was a problem hiding this comment.
thx for review
using ifelse is better?
There was a problem hiding this comment.
Yeah looks great -- I am just a fan of the ternary operator 😁.
|
Also you'll need to merge main once and possibly twice if #18586 lands while this is being reviewed. |
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
thx for review ` |
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
rgs1
left a comment
There was a problem hiding this comment.
Looks great - thank you! One last ask: can you add an entry to docs/root/version_history/current.rst noting this was added?
| return route_criteria; | ||
| } | ||
|
|
||
| return metadata_match_criteria_.get(); |
There was a problem hiding this comment.
Yeah looks great -- I am just a fan of the ternary operator 😁.
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
done. |
…hrift_metadata_filter Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
rgs1
left a comment
There was a problem hiding this comment.
Thanks! One last thing then it's good for me.
| * http: added support for :ref:`retriable health check status codes <envoy_v3_api_field_config.core.v3.HealthCheck.HttpHealthCheck.retriable_statuses>`. | ||
| * thrift_proxy: add upstream response zone metrics in the form ``cluster.cluster_name.zone.local_zone.upstream_zone.thrift.upstream_resp_success``. | ||
| * vcl_socket_interface: added VCL socket interface extension for fd.io VPP integration to :ref:`contrib images <install_contrib>`. This can be enabled via :ref:`VCL <envoy_v3_api_msg_extensions.vcl.v3alpha.VclSocketInterface>` configuration. | ||
| * thrift_proxy: support subset lb for request metadata filter. |
There was a problem hiding this comment.
Nit - I think it should be just:
* thrift_proxy: support subset lb when using request or route metadata.
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
…voy into add_thrift_metadata_filter Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
|
@xiaoma2015 please merge main. |
…hrift_metadata_filter Signed-off-by: Zhangdong Ma <zhdma_xd@163.com>
|
Signed-off-by: Zhangdong Ma zhdma_xd@163.com
Commit Message:
Implement the function of subset lb for request metadata filter like http:
envoy/source/common/router/router.h
Line 349 in 96701cb
Risk Level: Low
Testing: N/A
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]