mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
Add MustIncludeAdditionalItemPVCs to help track BIA added PVC's PVB creation. (#10501)
* Add MustIncludeAdditionalItemPVCs structure in backup. It's used to track PVCs returned by BIA with mustIncluded annotaion and PVC is excluded from backup by global filter. * Modfiy the volumeHelper interface to add a parameter function for ShouldPerformFSBackup. * Modify to support fine-grained backup filters. * Modify according to comments. Use a read-only interface to replace the parameter function. Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
@@ -93,6 +93,7 @@ func ShouldPerformSnapshotWithVolumeHelper(
|
||||
crClient,
|
||||
boolptr.IsSetToTrue(backup.Spec.DefaultVolumesToFsBackup),
|
||||
true,
|
||||
nil,
|
||||
)
|
||||
|
||||
return volumeHelperImpl.ShouldPerformSnapshot(unstructured, groupResource)
|
||||
@@ -111,6 +112,7 @@ func NewVolumeHelperWithNamespaces(
|
||||
defaultVolumesToFSBackup bool,
|
||||
backupExcludePVC bool,
|
||||
namespaces []string,
|
||||
pvcMustInclusionTracker vhutil.PVCMustInclusionTracker,
|
||||
) (vhutil.VolumeHelper, error) {
|
||||
return volumehelper.NewVolumeHelperImplWithNamespaces(
|
||||
volumePolicy,
|
||||
@@ -120,6 +122,7 @@ func NewVolumeHelperWithNamespaces(
|
||||
defaultVolumesToFSBackup,
|
||||
backupExcludePVC,
|
||||
namespaces,
|
||||
pvcMustInclusionTracker,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -131,11 +134,13 @@ func NewVolumeHelperWithCache(
|
||||
client crclient.Client,
|
||||
logger logrus.FieldLogger,
|
||||
pvcPodCache *podvolumeutil.PVCPodCache,
|
||||
pvcMustInclusionTracker vhutil.PVCMustInclusionTracker,
|
||||
) (vhutil.VolumeHelper, error) {
|
||||
return volumehelper.NewVolumeHelperImplWithCache(
|
||||
backup,
|
||||
client,
|
||||
logger,
|
||||
pvcPodCache,
|
||||
pvcMustInclusionTracker,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -300,6 +300,7 @@ func TestShouldPerformSnapshotWithNonNilVolumeHelper(t *testing.T) {
|
||||
false, // defaultVolumesToFSBackup
|
||||
true, // backupExcludePVC
|
||||
[]string{"default"},
|
||||
nil,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, vh)
|
||||
|
||||
Reference in New Issue
Block a user