Merge pull request #130924 from serathius/watchcache-delegate-precedense

Change precedence order for continue and legacy exact match
This commit is contained in:
Kubernetes Prow Robot 2025-03-19 10:19:30 -07:00 committed by GitHub
commit 593906d607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -257,14 +257,14 @@ func shouldDelegateList(opts storage.ListOptions, cache delegator.Helper) (deleg
case metav1.ResourceVersionMatchNotOlderThan: case metav1.ResourceVersionMatchNotOlderThan:
return delegator.Result{ShouldDelegate: false}, nil return delegator.Result{ShouldDelegate: false}, nil
case "": case "":
// Legacy exact match
if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
return cache.ShouldDelegateExactRV(opts.ResourceVersion, opts.Recursive)
}
// Continue // Continue
if len(opts.Predicate.Continue) > 0 { if len(opts.Predicate.Continue) > 0 {
return cache.ShouldDelegateContinue(opts.Predicate.Continue, opts.Recursive) return cache.ShouldDelegateContinue(opts.Predicate.Continue, opts.Recursive)
} }
// Legacy exact match
if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
return cache.ShouldDelegateExactRV(opts.ResourceVersion, opts.Recursive)
}
// Consistent Read // Consistent Read
if opts.ResourceVersion == "" { if opts.ResourceVersion == "" {
return cache.ShouldDelegateConsistentRead() return cache.ShouldDelegateConsistentRead()

View File

@ -172,14 +172,14 @@ func shouldDelegateList(opts *metav1.ListOptions, cache delegator.Helper) (deleg
case metav1.ResourceVersionMatchNotOlderThan: case metav1.ResourceVersionMatchNotOlderThan:
return delegator.Result{ShouldDelegate: false}, nil return delegator.Result{ShouldDelegate: false}, nil
case "": case "":
// Legacy exact match
if opts.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
return cache.ShouldDelegateExactRV(opts.ResourceVersion, defaultRecursive)
}
// Continue // Continue
if len(opts.Continue) > 0 { if len(opts.Continue) > 0 {
return cache.ShouldDelegateContinue(opts.Continue, defaultRecursive) return cache.ShouldDelegateContinue(opts.Continue, defaultRecursive)
} }
// Legacy exact match
if opts.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
return cache.ShouldDelegateExactRV(opts.ResourceVersion, defaultRecursive)
}
// Consistent Read // Consistent Read
if opts.ResourceVersion == "" { if opts.ResourceVersion == "" {
return cache.ShouldDelegateConsistentRead() return cache.ShouldDelegateConsistentRead()