-
Notifications
You must be signed in to change notification settings - Fork 556
[Snapshot Cache] Simplify Snapshot cache responses. #1356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pkg/cache/v3/simple.go
Outdated
| cache.log.Debugf("respond %s (requested %v) version %q with version %q and resources %v", request.GetTypeUrl(), request.GetResourceNames(), request.GetVersionInfo(), version, slices.Collect(maps.Keys(resp.GetReturnedResources()))) | ||
| // This implementation can seem more complex than needed, as it does not blindly rely on the request version. | ||
| // This allows for a more generic implemenentation when considering wildcard + subscribed, or partial replies. | ||
| // In other context a lot could be simplified as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, updated
pkg/cache/v3/snapshot.go
Outdated
| typeURL, referenceSet, len(items.Items)) | ||
| } | ||
|
|
||
| // Check superset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Check superset. | |
| // Check difference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
db37516 to
eaddffa
Compare
The snapshot cache reply logic for sotw and delta watches has grown complex and very distinct from the linear cache. This has created issues recently, mostly related to the logic in `CreateWatch` having to perfectly match the one in `respond` to avoid major issues. This commit simplifies the code in the same model as the linear cache: a single method creates the response, and the watch is created if no response is returned. There is some behavior change: if the type is not Listeners or Clusters, the control-plane will now only return the modified resources, per the xDS protocol. Please create an issue if this creates problems. Further work will build on this to: - support a new snapshot model, allowing per type updates and versions, as well as better delta handling - use per-resource version even in sotw to avoid resending resources when not needed. - provide support for partial wildcard responses, to provide a new support model for wildcard + resources subscriptions (e.g. for OdCDS). Signed-off-by: Valerian Roche <valerian.roche@gmail.com>
eaddffa to
aaeb8a9
Compare
The snapshot cache reply logic for sotw and delta watches has grown complex and very distinct from the linear cache. This has created issues recently, mostly related to the logic in
CreateWatchhaving to perfectly match the one inrespondto avoid major issues. This commit simplifies the code in the same model as the linear cache: a single method creates the response, and the watch is created if no response is returned.There is some behavior change: if the type is not Listeners or Clusters, the control-plane will now only return the modified resources, per the xDS protocol. Please create an issue if this creates problems.
Further work will build on this to: