Merge pull request #2390 from skriss/fix-2366

bug fix: save PVBs even if no snapshot was taken
This commit is contained in:
Ashish Amarnath
2020-04-08 12:21:43 -07:00
committed by GitHub
3 changed files with 2 additions and 4 deletions

View File

@@ -0,0 +1 @@
bug fix: save PodVolumeBackup manifests to object storage even if the volume was empty, so that on restore, the PV is dynamically reprovisioned if applicable

View File

@@ -174,9 +174,6 @@ ForEachVolume:
case res := <-resultsChan:
switch res.Status.Phase {
case velerov1api.PodVolumeBackupPhaseCompleted:
if res.Status.SnapshotID == "" { // when the volume is empty there is no restic snapshot, so best to exclude it
break
}
podVolumeBackups = append(podVolumeBackups, res)
case velerov1api.PodVolumeBackupPhaseFailed:
errs = append(errs, errors.Errorf("pod volume backup failed: %s", res.Status.Message))

View File

@@ -1034,7 +1034,7 @@ func (ctx *context) restoreItem(obj *unstructured.Unstructured, groupResource sc
}
if pvc.Spec.VolumeName != "" && ctx.pvsToProvision.Has(pvc.Spec.VolumeName) {
ctx.log.Infof("Resetting PersistentVolumeClaim %s/%s for dynamic provisioning because its PV %v has a reclaim policy of Delete", namespace, name, pvc.Spec.VolumeName)
ctx.log.Infof("Resetting PersistentVolumeClaim %s/%s for dynamic provisioning", namespace, name)
// use the unstructured helpers here since we're only deleting and
// the unstructured converter will add back (empty) fields for metadata