Skip podvolumerestore creation when restore excludes pv/pvc

Signed-off-by: half-life666 <half-life@jibudata.com>
pull/4769/head
half-life666 2022-03-23 15:29:52 +08:00
parent 38c83d608a
commit e24c8845c4
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1 @@
Skip podvolumerestore creation when restore excludes pv/pvc

View File

@ -1296,7 +1296,10 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
return warnings, errs
}
if len(restic.GetVolumeBackupsForPod(ctx.podVolumeBackups, pod, originalNamespace)) > 0 {
// Do not create podvolumerestore when current restore excludes pv/pvc
if ctx.resourceIncludesExcludes.ShouldInclude(kuberesource.PersistentVolumeClaims.String()) &&
ctx.resourceIncludesExcludes.ShouldInclude(kuberesource.PersistentVolumes.String()) &&
len(restic.GetVolumeBackupsForPod(ctx.podVolumeBackups, pod, originalNamespace)) > 0 {
restorePodVolumeBackups(ctx, createdObj, originalNamespace)
}
}