Skip to content

Commit 39b6bd1

Browse files
committed
address pwschuurman's comments
1 parent f9f8b78 commit 39b6bd1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/controller/volume/pvcprotection/pvc_protection_controller.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (c *Controller) processPVCsByNamespace(ctx context.Context) bool {
222222
c.queue.Forget(pvcKey)
223223
} else {
224224
c.queue.AddRateLimited(pvcKey)
225-
utilruntime.HandleError(fmt.Errorf("PVC %v in namespace %v failed with: %w", pvcName, namespace, err))
225+
utilruntime.HandleError(fmt.Errorf("PVC %v/%v failed with: %w", pvcName, namespace, err))
226226
}
227227
c.queue.Done(pvcKey)
228228
}
@@ -310,9 +310,11 @@ func (c *Controller) isBeingUsed(ctx context.Context, pvc *v1.PersistentVolumeCl
310310
// Even if no Pod using pvc was found in the Informer's cache it doesn't
311311
// mean such a Pod doesn't exist: it might just not be in the cache yet. To
312312
// be 100% confident that it is safe to delete pvc make sure no Pod is using
313-
// it among those returned by a live list.
313+
// it among those returned by a "lazy" live list.
314314

315-
// Use lazy live pod list instead of directly calling API server
315+
// Use a "lazy" live pod list: lazyLivePodList caches the first successful live pod list response,
316+
// so for a large number of PVC deletions in a short duration, subsequent requests can use the cached pod list
317+
// instead of issuing a lot of API requests. The cache is refreshed for each run of processNextWorkItem().
316318
return c.askAPIServer(ctx, pvc, lazyLivePodList)
317319
}
318320

0 commit comments

Comments
 (0)