Handle expired errors with RV>0 in pager, don't full list if 1st page is expired

Kubernetes-commit: 1f3dc14eea231c90819cbba06f25cb4221236b3f
This commit is contained in:
Joe Betz
2019-10-04 17:08:22 -07:00
committed by Kubernetes Publisher
parent 7d13a606b3
commit 54033229aa
3 changed files with 222 additions and 15 deletions

View File

@@ -87,7 +87,11 @@ func (p *ListPager) List(ctx context.Context, options metav1.ListOptions) (runti
obj, err := p.PageFn(ctx, options)
if err != nil {
if !errors.IsResourceExpired(err) || !p.FullListIfExpired {
// Only fallback to full list if an "Expired" errors is returned, FullListIfExpired is true, and
// the "Expired" error occurred in page 2 or later (since full list is intended to prevent a pager.List from
// failing when the resource versions is established by the first page request falls out of the compaction
// during the subsequent list requests).
if !errors.IsResourceExpired(err) || !p.FullListIfExpired || options.Continue == "" {
return nil, err
}
// the list expired while we were processing, fall back to a full list