diff --git a/changelogs/unreleased/2218-cpanato b/changelogs/unreleased/2218-cpanato new file mode 100644 index 0000000000..eb3001f70a --- /dev/null +++ b/changelogs/unreleased/2218-cpanato @@ -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. \ No newline at end of file diff --git a/pkg/cmd/cli/restore/create.go b/pkg/cmd/cli/restore/create.go index 09f12412d5..f30ee13071 100644 --- a/pkg/cmd/cli/restore/create.go +++ b/pkg/cmd/cli/restore/create.go @@ -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