mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 13:55:20 +00:00
Address review feedback
- Use ResolveNamespaceList() instead of GetIncludes() for more accurate namespace resolution when building the PVC-to-Pod cache - Refactor NewVolumeHelperImpl to call NewVolumeHelperImplWithCache with nil cache parameter to avoid code duplication Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
This commit is contained in:
@@ -413,8 +413,11 @@ func (kb *kubernetesBackupper) BackupWithResolvers(
|
||||
// This avoids O(N*M) complexity when there are many PVCs and pods.
|
||||
// See issue #9179 for details.
|
||||
pvcPodCache := podvolumeutil.NewPVCPodCache()
|
||||
namespaces := backupRequest.NamespaceIncludesExcludes.GetIncludes()
|
||||
if len(namespaces) > 0 {
|
||||
namespaces, err := backupRequest.NamespaceIncludesExcludes.ResolveNamespaceList()
|
||||
if err != nil {
|
||||
log.WithError(err).Warn("Failed to resolve namespace list for PVC-to-Pod cache, falling back to direct lookups")
|
||||
pvcPodCache = nil
|
||||
} else if len(namespaces) > 0 {
|
||||
if err := pvcPodCache.BuildCacheForNamespaces(context.Background(), namespaces, kb.kbClient); err != nil {
|
||||
// Log warning but continue - the cache will fall back to direct lookups
|
||||
log.WithError(err).Warn("Failed to build PVC-to-Pod cache, falling back to direct lookups")
|
||||
|
||||
Reference in New Issue
Block a user