mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
Invalidate restores based on missing backups
When creating a restore based on a backup that doesn't exist, the restore should be marked as invalid and the error clearly communicated so the user understands why the restore wasn't made. Previously, the restore was left as in progress with an error attached. Since restores are CRDs and must be updated via a controller, there's currently not a way to give the client immediate errors. Signed-off-by: Nolan Brubaker <nolan@heptio.com>
This commit is contained in:
@@ -294,6 +294,8 @@ func (controller *restoreController) getValidationErrors(itm *api.Restore) []str
|
||||
|
||||
if itm.Spec.BackupName == "" {
|
||||
validationErrors = append(validationErrors, "BackupName must be non-empty and correspond to the name of a backup in object storage.")
|
||||
} else if _, err := controller.fetchBackup(controller.bucket, itm.Spec.BackupName); err != nil {
|
||||
validationErrors = append(validationErrors, fmt.Sprintf("Error retrieving backup: %v", err))
|
||||
}
|
||||
|
||||
includedResources := sets.NewString(itm.Spec.IncludedResources...)
|
||||
|
||||
Reference in New Issue
Block a user