thrift: Reject router config if cluster/weighted clusters/mirror cluster doesn't exist for static route config provider#20577
Conversation
…er doesnt exist Signed-off-by: kuochunghsu <[email protected]>
|
Before I fixed all the interesting tests and add the appropriate test coverage. Like http config setup, we don't validate the cluster for rds. Instead, only validate the clusters in static config. Which introduce two interfaces I'm hesitating to determine: I'm not sure if we need to have the flexibility the change the Currently I keep the flexibility since reverting interface is expensive . Same thing, for thrift RouteMatcher, we could pass the limited information It's not an interface, we might want the minimal exposure principal? |
|
After I take another look, 1. is not an issue given the config traits in common/rds doesn't know if it should create a config with validation. Unless the traits take another parameters. I'll go ahead with 2. to minimal exposure and fix the tests. |
Signed-off-by: kuochunghsu <[email protected]>
Signed-off-by: kuochunghsu <[email protected]>
source/extensions/filters/network/thrift_proxy/router/router_impl.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: kuochunghsu <[email protected]>
test/extensions/filters/network/thrift_proxy/conn_manager_test.cc
Outdated
Show resolved
Hide resolved
test/extensions/filters/network/thrift_proxy/conn_manager_test.cc
Outdated
Show resolved
Hide resolved
test/extensions/filters/network/thrift_proxy/conn_manager_test.cc
Outdated
Show resolved
Hide resolved
Since it is not protocol specific, I think the
I also vote for minimal exposure. |
Signed-off-by: kuochunghsu <[email protected]>
Signed-off-by: kuochunghsu <[email protected]>
|
Don't you add flag for the validation into the config proto? |
No. Currently follow what the http did: only validate in static provider. No config proto is able to change the behavior at the moment. As for your scenario, envoy will retry after the cluster arrives after it fails at startup without cluster information. Not perfect but it works. |
For the test failure in "envoy-presubmit (check linux_x64 clang_tidy)" , I guess it's unrelated since I didn't touch nor include the logger. |
|
Note: We might want envoy/api/envoy/config/route/v3/route.proto Line 110 in a308789 |
|
/retest |
|
Retrying Azure Pipelines: |
I would set the default to false even for of static case and add the flag to the proto to control the validation. |
| route: | ||
| cluster: cluster2 | ||
| )EOF"; | ||
|
|
There was a problem hiding this comment.
nit: if you want, you can add back the assert for the case when the cluster list is empty.
| virtual ConfigConstSharedPtr createConfig(const Protobuf::Message& rc) const PURE; | ||
| virtual ConfigConstSharedPtr createConfig(const Protobuf::Message& rc, | ||
| Server::Configuration::ServerFactoryContext& context, | ||
| bool validate_clusters_default) const PURE; |
There was a problem hiding this comment.
Please document the new params in the Doxygen-style comments above.
Signed-off-by: kuochunghsu <[email protected]>
Signed-off-by: kuochunghsu <[email protected]>
|
@htuch it's ready to have another review with three follow-up items thanks |
This might need a manual merge. However the clang-tidy can't parse envoy/source/common/common/BUILD Line 218 in 2be0d7d |
|
The logger was indirectly added by including "envoy/server/factory_context.h", probably without adding the deps for it to envoy/rds/config_traits.h |
|
/wait for deps to be patched up |
Signed-off-by: kuochunghsu <[email protected]>
It's a promising solution and it takes some effort to break the circular reference. Next commit is comming |
Head branch was pushed to by a user without write access
|
/retest |
|
Retrying Azure Pipelines: |
|
Would a reviewer please revisit? It looks that all the comments and feedback have been addressed. |
#20874) This is a continuation of #20577. Additional Description: Risk Level: low Testing: unit test Signed-off-by: kuochunghsu <[email protected]>
…ter doesn't exist for static route config provider (envoyproxy#20577) * Reject thrift router config if cluster/weighted clusters/mirror cluster don't exist * Only expose cluster information to `RouteMatcher` * Fix router ratelimit test, add unit test, add test coverage * address rgs1's , tkovacs-2's comment, Tamas and Harvey's comments * remove redundant ref, dead code and * add comment to state the current status * add dep lib Signed-off-by: kuochunghsu <[email protected]>
envoyproxy#20874) This is a continuation of envoyproxy#20577. Additional Description: Risk Level: low Testing: unit test Signed-off-by: kuochunghsu <[email protected]>
Signed-off-by: kuochunghsu [email protected]
Commit Message:
Expose
ServerFactoryContextto ConfigTraitsImpl::createConfig so the underlyingRouteEntryImplis able to validate its clusters.Currently HTTP validates the clusters for static route config by default but doesn't validate the clusters for RDS.
Moreover, optional field
validate_clusterschanges the default behavior.In this diff, thrift route config provider manager do the same default behavior for cluster validation.
That is, validate the clusters for static route config by default but not validate the clusters for TRDS.
Optional field
validate_clustersis coming soon.Risk Level: low
Testing: unit test
[Optional Fixes #Issue] #20559