cache: add prefix/glob watch support to LinearCache for LEDS#1411
Open
wdauchy wants to merge 1 commit intoenvoyproxy:mainfrom
Open
cache: add prefix/glob watch support to LinearCache for LEDS#1411wdauchy wants to merge 1 commit intoenvoyproxy:mainfrom
wdauchy wants to merge 1 commit intoenvoyproxy:mainfrom
Conversation
Envoy's LEDS uses delta xDS with glob collection subscriptions where clients subscribe to resource names ending in /* (e.g. ns_svc_8080/us-east-1a/*) and expect to receive all individual resources whose name starts with that prefix. Currently LinearCache only supports exact-name watches and full wildcard watches. A subscription to collection/* is stored as a literal key in resourceWatches and never matches individual resources under that prefix. Add a new prefixWatches map to LinearCache that is keyed by the prefix (with trailing * stripped, keeping the separator). When a subscribed resource name ends with /*, the watch is registered in prefixWatches instead of resourceWatches. notifyAll iterates prefixWatches for each modified resource and triggers matching prefix watches. computeResourceChange expands prefix subscriptions to all matching resources in the cache, detecting new, updated, and deleted resources under the prefix. Signed-off-by: William Dauchy <[email protected]> Co-authored-by: Cursor <[email protected]>
aefeae0 to
441aa0e
Compare
wdauchy
commented
Feb 23, 2026
Contributor
Author
wdauchy
left a comment
There was a problem hiding this comment.
fyi I started to merge this on Datadog production to see how far we can go with it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Envoy's LEDS (Locality Endpoint Discovery Service) uses delta xDS with
glob collection subscriptions. Clients subscribe to resource names ending
in
/*(e.g.ns_svc_8080/us-east-1a/*) viaresource_names_subscribein
DeltaDiscoveryRequest, and expect to receive all individual resourceswhose name starts with that prefix.
Currently
LinearCacheonly supports exact-name watches (resourceWatches)and full wildcard (
wildcardWatches). A subscription tocollection/*isstored as a literal key in
resourceWatchesand never matches individualresources under that prefix.
This PR adds a
prefixWatchesmap toLinearCachethat handles globsubscriptions:
trackWatch: when a subscribed resource name ends with/*, thewatch is registered in
prefixWatches[prefix]instead ofresourceWatches[name]notifyAll: iteratesprefixWatchesfor each modified resource andtriggers matching prefix watches
computeResourceChange: expands prefix subscriptions to all matchingresources in the cache, detecting new, updated, and deleted resources
under the prefix
computeResponse: expands prefix globs in the full-state non-wildcardbranch
prefixWatchesentriesExisting exact-name and wildcard behavior is unchanged.