From b51a17138e2eec22575ea0d4eabf5ad12b7eb7dc Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Thu, 1 Dec 2022 15:12:07 +0800 Subject: [PATCH] fix issue 5458 Signed-off-by: Lyndon-Li --- pkg/backup/item_backupper.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/backup/item_backupper.go b/pkg/backup/item_backupper.go index aefbb85ce..da020eb0a 100644 --- a/pkg/backup/item_backupper.go +++ b/pkg/backup/item_backupper.go @@ -164,11 +164,6 @@ func (ib *itemBackupper) backupItem(logger logrus.FieldLogger, obj runtime.Unstr pvbVolumes = append(pvbVolumes, volume) } - - // track the volumes that are PVCs using the PVC snapshot tracker, so that when we backup PVCs/PVs - // via an item action in the next step, we don't snapshot PVs that will have their data backed up - // with pod volume backup. - ib.podVolumeSnapshotTracker.Track(pod, pvbVolumes) } } @@ -211,6 +206,13 @@ func (ib *itemBackupper) backupItem(logger logrus.FieldLogger, obj runtime.Unstr ib.backupRequest.PodVolumeBackups = append(ib.backupRequest.PodVolumeBackups, podVolumeBackups...) backupErrs = append(backupErrs, errs...) + + // track the volumes that are PVCs using the PVC snapshot tracker, so that when we backup PVCs/PVs + // via an item action in the next step, we don't snapshot PVs that will have their data backed up + // with pod volume backup. + for _, pvb := range podVolumeBackups { + ib.podVolumeSnapshotTracker.Track(pod, []string{pvb.Spec.Volume}) + } } log.Debug("Executing post hooks")