Restic Backup: Add check if Pod is successful or failed for emptyDir.… (#3993)

* Restic Backup: Add check if Pod is successful or failed for emptyDir. Fix #3812
* Add changelog

Signed-off-by: mahaupt <marcel.haupt@gepardec.com>
pull/4016/head
Marcel Haupt 2021-08-04 06:53:06 +02:00 committed by GitHub
parent 4834814d8a
commit 7cb614789c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1 @@
Fix restic error when volume is emptyDir and Pod not running

View File

@ -157,6 +157,11 @@ func (b *backupper) BackupPodVolumes(backup *velerov1api.Backup, pod *corev1api.
continue
}
// emptyDir volumes on finished pods are not supported because the volume is already gone and would result in an error
if (pod.Status.Phase == corev1api.PodSucceeded || pod.Status.Phase == corev1api.PodFailed) && volume.EmptyDir != nil {
continue
}
volumeBackup := newPodVolumeBackup(backup, pod, volume, repo.Spec.ResticIdentifier, pvc)
if volumeBackup, err = b.repoManager.veleroClient.VeleroV1().PodVolumeBackups(volumeBackup.Namespace).Create(context.TODO(), volumeBackup, metav1.CreateOptions{}); err != nil {
errs = append(errs, err)