Skip to content

vhds: use vhds virtual host over rds one upon name conflict - #44401

Merged
RyanTheOptimist merged 4 commits into
envoyproxy:mainfrom
Arkelenia:frederic/vhds-rds-collision-resolution
Nov 3, 2026
Merged

RyanTheOptimist merged 4 commits into
envoyproxy:mainfrom
Arkelenia:frederic/vhds-rds-collision-resolution

Conversation

@Arkelenia

Copy link
Copy Markdown
Contributor

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

@Arkelenia
Arkelenia had a problem deploying to external-contributors April 12, 2026 01:10 — with GitHub Actions Error
@repokitteh-read-only

Copy link
Copy Markdown

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.

🐱

Caused by: #44401 was opened by Arkelenia.

see: more, trace.

@Arkelenia
Arkelenia force-pushed the frederic/vhds-rds-collision-resolution branch from c72de58 to 0db315e Compare April 12, 2026 03:43
@Arkelenia
Arkelenia temporarily deployed to external-contributors April 12, 2026 03:43 — with GitHub Actions Inactive

@wdauchy wdauchy left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. A few suggestions below.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Comment thread test/common/router/vhds_test.cc Outdated
envoy_grpc:
cluster_name: xds_cluster
)EOF");
config_update_info->onRdsUpdate(updated_route_config, "2");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Comment thread test/common/router/vhds_test.cc Resolved
@Arkelenia
Arkelenia had a problem deploying to external-contributors April 13, 2026 15:37 — with GitHub Actions Error
@Arkelenia
Arkelenia force-pushed the frederic/vhds-rds-collision-resolution branch from 4b7d962 to 6080190 Compare April 13, 2026 15:49
@Arkelenia
Arkelenia temporarily deployed to external-contributors April 13, 2026 15:49 — with GitHub Actions Inactive
@wdauchy

wdauchy commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

@botengyao do you think you could take a look?

@Arkelenia
Arkelenia force-pushed the frederic/vhds-rds-collision-resolution branch from 6080190 to 3d79966 Compare April 13, 2026 20:43
@Arkelenia
Arkelenia temporarily deployed to external-contributors April 13, 2026 20:44 — with GitHub Actions Inactive

@adisuissa adisuissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@Arkelenia

Copy link
Copy Markdown
Contributor Author

@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?

@adisuissa

Copy link
Copy Markdown
Contributor

@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:

The contents of these two fields will be merged to generate a routing table for a given RouteConfiguration, with ``vhds`` derived configuration taking precedence.

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?

@adisuissa

Copy link
Copy Markdown
Contributor

I'm not saying your approach is incorrect, just that I'm not sure what was the intent of the original VHDS users.

@Arkelenia

Arkelenia commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

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?

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.

@wdauchy

wdauchy commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

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.

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?

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

@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #44401 was synchronize by Arkelenia.

see: more, trace.

@wdauchy

wdauchy commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

@Arkelenia could you merge main again to trigger a new CI?

@Arkelenia
Arkelenia force-pushed the frederic/vhds-rds-collision-resolution branch from cd3b2bb to eb399e0 Compare April 20, 2026 18:11
@Arkelenia
Arkelenia temporarily deployed to external-contributors April 20, 2026 18:11 — with GitHub Actions Inactive
@Arkelenia

Copy link
Copy Markdown
Contributor Author

@adisuissa Is there any concern with moving forward with this change?

@ravenblackx
ravenblackx requested a review from adisuissa April 29, 2026 19:13
@Arkelenia

Copy link
Copy Markdown
Contributor Author

@adisuissa just wanted to check in on this PR.

@kyessenov

Copy link
Copy Markdown
Contributor

/wait
for review

wbpcode pushed a commit that referenced this pull request Oct 8, 2026
… 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]>
@wdauchy

wdauchy commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@wbpcode would you mind looking at this one?

@wbpcode wbpcode assigned wbpcode and unassigned adisuissa Oct 13, 2026
@KBaichoo

Copy link
Copy Markdown
Contributor

Ping @wbpcode

@wbpcode wbpcode left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #44401 was synchronize by Arkelenia.

see: more, trace.

Arkelenia and others added 3 commits October 19, 2026 20:14
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]>
@Arkelenia
Arkelenia force-pushed the frederic/vhds-rds-collision-resolution branch from 5186dc3 to 5730729 Compare October 20, 2026 00:18
@Arkelenia
Arkelenia temporarily deployed to external-contributors October 20, 2026 00:18 — with GitHub Actions Inactive
wbpcode
wbpcode previously approved these changes Oct 22, 2026

@wbpcode wbpcode left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@wbpcode

wbpcode commented Oct 22, 2026

Copy link
Copy Markdown
Member

Seems the CI's failure is legit.

@wbpcode

wbpcode commented Oct 23, 2026

Copy link
Copy Markdown
Member

/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]>
@Arkelenia

Copy link
Copy Markdown
Contributor Author

@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.

@repokitteh-read-only repokitteh-read-only Bot removed the api label Nov 2, 2026
@wdauchy

wdauchy commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

/retest

@RyanTheOptimist
RyanTheOptimist merged commit 33f5cfe into envoyproxy:main Nov 3, 2026
26 checks passed

This branch was previously deployed

1 inactive deployment
external-contributors — c239bf84 Deployed Oct 27, 2026 by Arkelenia via authorize #60350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.