Change precedence order for continue and legacy exact match

This doesn't matter for shouldDelegateList, but matters when picking
source of RV. RV from continue takes precedence.
This commit is contained in:
Marek Siarkowicz 2025-03-19 13:58:43 +01:00
parent 73f54b67b2
commit 7da942ca74
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:
return delegator.Result{ShouldDelegate: false}, nil
case "":
// Legacy exact match
if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
return cache.ShouldDelegateExactRV(opts.ResourceVersion, opts.Recursive)
}
// Continue
if len(opts.Predicate.Continue) > 0 {
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
if opts.ResourceVersion == "" {
return cache.ShouldDelegateConsistentRead()

View File

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