re-instantiate backup store just before persisting artifacts (#2550)

Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
Steve Kriss
2020-05-27 17:03:52 -06:00
committed by GitHub
parent d10eea3ba3
commit 5b52fd3efd
3 changed files with 19 additions and 1 deletions

View File

@@ -533,7 +533,7 @@ func (c *backupController) runBackup(backup *pkgbackup.Request) error {
return err
}
backupLog.Info("Setting up backup store")
backupLog.Info("Setting up backup store to check for backup existence")
backupStore, err := c.newBackupStore(backup.StorageLocation, pluginManager, backupLog)
if err != nil {
return err
@@ -612,6 +612,14 @@ func (c *backupController) runBackup(backup *pkgbackup.Request) error {
backup.Status.Phase = velerov1api.BackupPhaseCompleted
}
// re-instantiate the backup store because credentials could have changed since the original
// instantiation, if this was a long-running backup
backupLog.Info("Setting up backup store to persist the backup")
backupStore, err = c.newBackupStore(backup.StorageLocation, pluginManager, backupLog)
if err != nil {
return err
}
if errs := persistBackup(backup, backupFile, logFile, backupStore, c.logger, volumeSnapshots, volumeSnapshotContents); len(errs) > 0 {
fatalErrs = append(fatalErrs, errs...)
}