Repository navigation
vhds: use vhds virtual host over rds one upon name conflict - #44401
RyanTheOptimist merged 4 commits into
Conversation
|
Hi @Arkelenia, 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. |
c72de58 to
0db315e
Compare
| if (vh.name() == "overlapping_vhost") { | ||
| // The VHDS version should have "vhost.vhds.domain", not "vhost.rds.domain" | ||
| EXPECT_EQ("vhost.vhds.domain", vh.domains(0)); | ||
| found_vhds_version = true; |
There was a problem hiding this comment.
The assertions here iterate and match by name, but never fail explicitly if overlapping_vhost is missing. If the loop doesn't find it, found_vhds_version stays false and the EXPECT_TRUE below catches it — that works, but the failure message would be opaque.
Consider a helper or ASSERT_TRUE(found_vhds_version) << "VHDS version of overlapping_vhost not found"; for a clearer diagnostic on failure.
| envoy_grpc: | ||
| cluster_name: xds_cluster | ||
| )EOF"); | ||
| config_update_info->onRdsUpdate(updated_route_config, "2"); |
There was a problem hiding this comment.
This test doesn't assert that overlapping_vhost was actually found during the loop. If the vhost is somehow absent, the loop silently passes. Add a boolean + final assertion like the first test does.
4b7d962 to
6080190
Compare
|
@botengyao do you think you could take a look? |
6080190 to
3d79966
Compare
adisuissa
left a comment
There was a problem hiding this comment.
Thanks for fixing the issue.
Can you add a pointer to the relevant docs?
Looking at the proto description and the docs it is unclear why VHDS take precedence (just that the virtual-host is merged between the RDS and VHDS).
|
@adisuissa The proto description you linked explicitly states that VHDS is supposed to take precedence over RDS when they get merged. I think the choice was made with the intent of RDS providing fleet-wide defaults and VHDS providing node-specific virtual hosts. I'll defer to you on whether we want to change the behavior considering that no one can currently rely on it anyway. Do you want me to link those ion the PR description or commit message? |
AFAICT it says the following: My reading of the code is that it takes the virtual host from the routes and then adds the virtual hosts from the VHDS. Should it be that the contents of the virtual-hosts are merged instead? |
|
I'm not saying your approach is incorrect, just that I'm not sure what was the intent of the original VHDS users. |
|
Ah I see, I think I misunderstood your original message. Sorry about that. My read on it was that virtual host contents would not be merged together and instead one vhost would take precedence over the other upon name collisions. But you are right that the documentation is very vague on what constitutes a collision and what merging means.
The code today only appends VHDS vhosts to the RDS vhost array but merging the content of vhosts might have been the original intent. I think that merging the contents of a vhost is quite tricky though, especially when it comes to routes because the ordering has semantic meaning there. We could try to build some heuristic for merging routes if we want to go in that direction. That being said, if someone is already able to leverage VHDS, they already have the control plane infrastructure in place to merge the vhosts together and distribute them through VHDS (relying on the fact that the whole VHDS vhost will take precedence). I think that merging two colliding vhosts is too ambiguous for Envoy to get consistently right. What do you think? I can also update the docs to make it more explicit what collision and merge mean in the context of VHDS. |
+1 lets make the doc clearer in the same PR |
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
|
@Arkelenia could you merge main again to trigger a new CI? |
cd3b2bb to
eb399e0
Compare
|
@adisuissa Is there any concern with moving forward with this change? |
|
@adisuissa just wanted to check in on this PR. |
|
/wait |
… route (#48079) Commit Message: on_demand: continue to the router when the on-demand VHDS virtual host has no matching route. Additional Description: After #47183, onRouteConfigUpdateCompletion() re-runs decodeHeaders() once VHDS reports that the virtual host exists. route_exists only means the virtual host exists, not that one of its routes matches the request. If none match, decodeHeaders() requests the same virtual host again. Since #46216 that repeated request is not sent, so the request waits until the stream idle timeout. Before #46216 it was sent and answered again, so the request looped on VHDS. The legacy recreateStream() path has the same problem. This change re-checks route() after refreshing the route config snapshot. route_exists now means a route was found, as the scoped RDS callback already reports. If no route matches, the filter continues to the router, which replies with a 404. Tradeoff: a virtual host that only gains the matching route in a later VHDS update is no longer picked up while the request waits. Upstream never answered this case before: the request looped or waited until the stream idle timeout. Related PRs: - #48000 answers repeated VHDS requests locally. With that change, the decodeHeaders() re-run would get an immediate answer for the same virtual host and request it again. Continuing to the router when no route matches avoids that. - #44401 lets a VHDS virtual host replace an RDS virtual host with the same name. If the VHDS copy also has no route for the request, the request currently waits until the stream idle timeout. With this change it gets a 404. Risk Level: Low. Guarded, limited to on-demand VHDS. Testing: New unit tests in on_demand_filter_test cover both values of the new guard and of on_demand_vhds_no_recreate_stream. New integration tests in vhds_integration_test cover both on_demand_vhds_no_recreate_stream values. Without the fix, the new tests with the guard enabled fail and the integration requests time out waiting for a response. on_demand_filter_test, vhds_integration_test, odcds_integration_test and on_demand_integration_test pass. Docs Changes: N/A Release Notes: Added under changelogs/current/bug_fixes. Platform Specific Features: N/A Runtime guard: envoy.reloadable_features.on_demand_vhds_require_route_match (default true). Set it to false to restore the previous behavior. AI assistance: Cursor helped trace the issue and write the tests. I reviewed and understand all changes. Signed-off-by: William Dauchy <[email protected]>
|
@wbpcode would you mind looking at this one? |
|
Ping @wbpcode |
wbpcode
left a comment
There was a problem hiding this comment.
it's reasonable changes to prefer the vids discovered one. Thanks for this contribution. Please add change log and also a runtime flag for this behavior change.
/wait
Signed-off-by: Frederic Hemery <[email protected]>
Signed-off-by: Frederic Hemery <[email protected]>
Guard the VHDS-over-RDS virtual host name collision resolution behind envoy.reloadable_features.vhds_overrides_rds_virtual_hosts_with_same_name and add a minor behavior change release note. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Frederic Hemery <[email protected]>
5186dc3 to
5730729
Compare
|
Seems the CI's failure is legit. |
|
/wait |
…-rds-collision-resolution Adapt vhds_test to the removal of protobufConfigurationCast() upstream. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Frederic Hemery <[email protected]>
|
@wbpcode Sorry for the delay. There had been an interface change since this PR was opened and some of the tests were still using the old interface. My bad. |
|
/retest |
Commit Message: This PR allows VHDS to explicitly take precedence if virtual host names collide.
Additional Description: If a virtual host is distributed through VHDS and RDS at the same time, then all further VHDS or RDS updates are stuck.
Risk Level: Medium
Testing: added unit tests
Docs Changes: Nothing as the docs already indicate that VHDS is meant to take precedence over RDS.
Release Notes: Allow VHDS to take precedence over RDS for virtual hosts with colliding names
Platform Specific Features: N/A