Require DeleteBackupRequest.Spec.BackupName

Make sure a DeleteBackupRequest has its Spec.BackupName filled in. If
not, record an error in the status and mark the request as processed.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
Andy Goldstein
2018-04-05 14:53:10 -04:00
parent 4328b67f93
commit ef57a44827
2 changed files with 29 additions and 0 deletions

View File

@@ -133,6 +133,14 @@ func (c *backupDeletionController) processRequest(req *v1.DeleteBackupRequest) e
"backup": req.Spec.BackupName,
})
if req.Spec.BackupName == "" {
_, err := c.patchDeleteBackupRequest(req, func(r *v1.DeleteBackupRequest) {
r.Status.Phase = v1.DeleteBackupRequestPhaseProcessed
r.Status.Errors = []string{"spec.backupName is required"}
})
return err
}
var err error
// Update status to InProgress