Merge pull request #2218 from cpanato/GH-1168

remove schedule validation
pull/2238/head
Ashish Amarnath 2020-01-31 13:00:24 -08:00 committed by GitHub
commit 21264a11ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1 @@
remove the schedule validation and instead of checking the schedule because we might be in another cluster we check if a backup exist with the schedule name.

View File

@ -171,9 +171,13 @@ func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Facto
return err
}
case o.ScheduleName != "":
if _, err := o.client.VeleroV1().Schedules(f.Namespace()).Get(o.ScheduleName, metav1.GetOptions{}); err != nil {
backupItems, err := o.client.VeleroV1().Backups(f.Namespace()).List(metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", api.ScheduleNameLabel, o.ScheduleName)})
if err != nil {
return err
}
if len(backupItems.Items) == 0 {
return errors.Errorf("No backups found for the schedule %s", o.ScheduleName)
}
}
return nil