Repository navigation
Conversation
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
This intentionally duplicates router-internal stat naming/tagging logic; if upstream… · NewRuntime::maybeSetRuntimeGuard(...)mutates a process-global runtime feature flag and is not… · New When the module passes a null pointer with a non-zero length,toStringView()yields an empty… · Newswept_size_is initialized to 0, sosize >= 2 * swept_size_is true on initial calls, causing a… · New
What changed in this PR
This PR adds virtual cluster selection support to the dynamic modules route specifier, allowing modules to label requests with a declared virtual cluster and optionally prefer that selection over the virtual host’s linear scan while maintaining consistent virtual-cluster statistics.
Changes:
- Add
set_virtual_clustercallback and plumbing to carry a virtual-cluster selection through dynamic-module routing and built-route-cache behavior. - Introduce a shared registry of declared virtual clusters and a virtual-host/route wrapper to supply the selected virtual cluster to the router.
- Add extensive unit/integration tests plus API/docs/changelog updates for the new configuration and behavior.
| File | Description |
|---|---|
| test/extensions/router/route_specifiers/dynamic_modules/route_specifier_test.cc | Adds unit tests covering selection, comparison, logging, caching interactions, and registry behavior. |
| test/extensions/router/route_specifiers/dynamic_modules/integration_test.cc | Adds integration coverage for preferred vs compared selection and stats/tag expectations. |
| test/extensions/router/route_specifiers/dynamic_modules/BUILD | Adds deps and test module target needed for virtual cluster selection tests. |
| test/extensions/dynamic_modules/test_data/rust/route_specifier_integration_test.rs | Extends Rust test module behavior to drive set_virtual_cluster via request headers. |
| test/extensions/dynamic_modules/test_data/c/route_specifier_virtual_cluster.c | Adds a C test module that selects virtual clusters and exercises edge cases (unknown/null buffer). |
| test/extensions/dynamic_modules/test_data/c/route_specifier_built_route_cache.c | Extends built-route-cache test module to vary on virtual cluster selection. |
| test/extensions/dynamic_modules/test_data/c/BUILD | Registers the new C test program target. |
| test/extensions/dynamic_modules/abi_impl_test.cc | Adds weak stub for the new ABI callback used in tests. |
| source/extensions/router/route_specifiers/dynamic_modules/route_specifier.h | Adds declared virtual cluster types/registry, selection-carrying wrappers, config fields, and stats. |
| source/extensions/router/route_specifiers/dynamic_modules/route_specifier.cc | Implements declared vcluster stats creation, registry lifecycle/sweeping, wrapper behavior, and selection dropping. |
| source/extensions/router/route_specifiers/dynamic_modules/abi_impl.cc | Implements envoy_dynamic_module_callback_route_specifier_set_virtual_cluster. |
| source/extensions/router/route_specifiers/dynamic_modules/BUILD | Adds required deps for router context/singletons/stats helpers and absl containers/hash. |
| source/extensions/dynamic_modules/sdk/rust/src/route_specifier.rs | Adds Rust SDK API surface set_virtual_cluster with documentation. |
| source/extensions/dynamic_modules/sdk/rust/src/lib_test.rs | Adds Rust SDK unit test coverage and stub implementation for set_virtual_cluster. |
| source/extensions/dynamic_modules/abi_impl.cc | Adds a weak stub for the new ABI callback in the dynamic modules ABI impl. |
| source/extensions/dynamic_modules/abi/abi.h | Documents and declares the new C ABI callback for virtual cluster selection. |
| docs/root/configuration/http/route_specifier/dynamic_modules.rst | Documents config semantics, counters, logging, and operational guidance for selection/comparison. |
| changelogs/current/new_features/dynamic_modules__route-specifier-virtual-cluster-selection.rst | Adds release note for the new feature. |
| api/envoy/extensions/router/route_specifiers/dynamic_modules/v3/dynamic_modules.proto | Adds VirtualClusterSelection message + virtual_cluster_selection field in the specifier config. |
Review effort: Lite
Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
b21199c to
6e83ec1
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Duplicated stats naming and tagging logic could drift between implementations, causing same-named virtual clusters to write to different counters.
1 open issue
4 resolved since last review
Runtime::maybeSetRuntimeGuard(...)mutates a process-global runtime feature flag and is not… This intentionally duplicates router-internal stat naming/tagging logic; if upstream…swept_size_is initialized to 0, sosize >= 2 * swept_size_is true on initial calls, causing a… When the module passes a null pointer with a non-zero length,toStringView()yields an empty…
Review effort: Max
| const Stats::StatNameTag tags[] = {{well_known.tag_virtual_host_, virtual_host}, | ||
| {well_known.tag_virtual_cluster_, virtual_cluster}}; | ||
| const Stats::StatNameJoiner base_prefix({well_known.vhost_, well_known.vcluster_}, symbol_table); | ||
| const Stats::StatNameJoiner prefix( | ||
| {well_known.vhost_, virtual_host, well_known.vcluster_, virtual_cluster}, symbol_table); | ||
| Stats::LiteScopeHelper helper(scope, base_prefix.statName(), tags, prefix.statName()); |
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for this contribution. Let's get agreement about the API first.
|
/wait |
…ecifier-virtual-cluster-selection
Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>


Description
This PR adds virtual cluster selection to the dynamic modules route specifier. A module selects the virtual cluster of a request from the names the configuration declares. The selection uses the statistics of the virtual cluster of the same name on the virtual host. The router either compares the selection with the virtual host or prefers it and skips the linear scan.
Commit Message: dynamic_modules: add virtual cluster selection to the route specifier
Risk Level: Low
Testing: Added Tests
Docs Changes: Added
Release Notes: Added