From c49afd44bd6f8212299734275a5ae654ba6a8a8f Mon Sep 17 00:00:00 2001 From: Ashish Amarnath Date: Wed, 6 May 2020 11:04:34 -0700 Subject: [PATCH] Use label selector to list VSCs to persist (#2502) Signed-off-by: Ashish Amarnath --- pkg/controller/backup_controller.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pkg/controller/backup_controller.go b/pkg/controller/backup_controller.go index a2224c25a..8772f7963 100644 --- a/pkg/controller/backup_controller.go +++ b/pkg/controller/backup_controller.go @@ -572,17 +572,9 @@ func (c *backupController) runBackup(backup *pkgbackup.Request) error { } if c.volumeSnapshotContentLister != nil { - // Since VolumeSnapshotContent objects are not currently labeled, get them by using binding from the VolumeSnapshot - for _, vs := range volumeSnapshots { - // nil check just in case the snapshot and the content object did not get bound before returning from the plugins - if vs.Status != nil && vs.Status.BoundVolumeSnapshotContentName != nil { - vsc, err := c.volumeSnapshotContentLister.Get(*vs.Status.BoundVolumeSnapshotContentName) - if err != nil { - backupLog.Error(err) - continue - } - volumeSnapshotContents = append(volumeSnapshotContents, vsc) - } + volumeSnapshotContents, err = c.volumeSnapshotContentLister.List(selector) + if err != nil { + backupLog.Error(err) } } }