Skip to content

Commit 6c7d1bc

Browse files
sxllwxk8s-publishing-bot
authored andcommitted
Add WithAlloc interface and stub implementations with base benchmarks
Kubernetes-commit: b8a3bd673dc61b4d7a0ad0f54fa423e0160078cf
1 parent f21df6e commit 6c7d1bc

File tree

3 files changed

+533
-4
lines changed

3 files changed

+533
-4
lines changed

tools/cache/reflector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ func (r *Reflector) list(stopCh <-chan struct{}) error {
510510
pager.PageSize = 0
511511
}
512512

513-
list, paginatedResult, err = pager.List(context.Background(), options)
513+
list, paginatedResult, err = pager.ListWithAlloc(context.Background(), options)
514514
if isExpiredError(err) || isTooLargeResourceVersionError(err) {
515515
r.setIsLastSyncResourceVersionUnavailable(true)
516516
// Retry immediately if the resource version used to list is unavailable.
@@ -519,7 +519,7 @@ func (r *Reflector) list(stopCh <-chan struct{}) error {
519519
// resource version it is listing at is expired or the cache may not yet be synced to the provided
520520
// resource version. So we need to fallback to resourceVersion="" in all to recover and ensure
521521
// the reflector makes forward progress.
522-
list, paginatedResult, err = pager.List(context.Background(), metav1.ListOptions{ResourceVersion: r.relistResourceVersion()})
522+
list, paginatedResult, err = pager.ListWithAlloc(context.Background(), metav1.ListOptions{ResourceVersion: r.relistResourceVersion()})
523523
}
524524
close(listCh)
525525
}()
@@ -557,7 +557,7 @@ func (r *Reflector) list(stopCh <-chan struct{}) error {
557557
}
558558
resourceVersion = listMetaInterface.GetResourceVersion()
559559
initTrace.Step("Resource version extracted")
560-
items, err := meta.ExtractList(list)
560+
items, err := meta.ExtractListWithAlloc(list)
561561
if err != nil {
562562
return fmt.Errorf("unable to understand list result %#v (%v)", list, err)
563563
}

0 commit comments

Comments
 (0)