From 16cf2780d8049f10768201fb66543e2b1778df3a Mon Sep 17 00:00:00 2001 From: Nolan Brubaker Date: Fri, 17 Apr 2020 18:42:14 -0400 Subject: [PATCH] Fetch contents based on volumesnapshots found Signed-off-by: Nolan Brubaker --- pkg/controller/backup_controller.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/controller/backup_controller.go b/pkg/controller/backup_controller.go index 24787198d..222ae41b3 100644 --- a/pkg/controller/backup_controller.go +++ b/pkg/controller/backup_controller.go @@ -562,10 +562,14 @@ func (c *backupController) runBackup(backup *pkgbackup.Request) error { } if c.volumeSnapshotContentLister != nil { - volumeSnapshotContents, err = c.volumeSnapshotContentLister.List(selector) - if err != nil { - backupLog.Error(err) - + // Since VolumeSnapshotContent objects are not currently labeled, get them by using binding from the VolumeSnapshot + for _, vs := range volumeSnapshots { + vsc, err := c.volumeSnapshotContentLister.Get(*vs.Status.BoundVolumeSnapshotContentName) + if err != nil { + backupLog.Error(err) + continue + } + volumeSnapshotContents = append(volumeSnapshotContents, vsc) } } }