velero: Restore from latest backup with only scheduleName set, does not work (as described in the api spec)

What steps did you take and what happened: i’m testing the restore process for our vault.

If im in a hurry i wouldn’t want to search first manually for the latest backup name from the schedule before i can restore a backup…

tried to restore the latest backup from a schedule as described in the crd spec

image

apiVersion: velero.io/v1
kind: Restore
metadata:
  name: test-vault
  namespace: vault-migration
spec:
  restorePVs: true
  scheduleName: vault

What did you expect to happen:

successfull creation of the restore cr

Environment:

velero/velero:v1.13.0
velero/velero-plugin-for-gcp:v1.9.0
GKE 1.27.10

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project’s top voted issues listed here.
Use the “reaction smiley face” up to the right of this comment to vote.

  • 👍 for “I would like to see this bug fixed as soon as possible”
  • 👎 for “There are more important bugs to focus on right now”

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Thanks all for the clarification. Looks like this is a bug since the scheduleName field has already been in the Restore CRD, and the logic to deal with it has already been in the server code, merely it cannot be specified without backupName. Therefore, we will fix it in 1.14.

This is a valid enhancement in my view.

On following

i dont want my collagues to possibly having to first download a cli, then setup this cli and then be able to restore a backup with this cli

We have been recommending user alias velero command to avoid downloading.

alias velero='kubectl -n velero exec deployment/velero -c velero -it -- ./velero'

So I had a couple comments, first, this doesn’t require any new fields, just making one field that’s already there optional, so it’s not a breaking change. In fact, the CRD comments on ScheduleName suggest that BackupName should already be optional, although it’s not currently defined that way:

        // BackupName is the unique name of the Velero backup to restore
        // from.
        BackupName string `json:"backupName"`

        // ScheduleName is the unique name of the Velero schedule to restore
        // from. If specified, and BackupName is empty, Velero will restore
        // from the most recent successful backup created from this schedule.
        // +optional
        ScheduleName string `json:"scheduleName,omitempty"`

Second, there’s a bit of a problem with the “CLI should always be used for more complicated situations, CR is only for basic cases” since in the past, the opposite has been true. There are fields available in the CRD that are not in the CLI. I think this is the only one that works in CLI but not CRD. Moving the logic down to the CR validation makes this consistent with other fields. For example, if you want to use the Hooks field and the FromSchedule field, you’re out of luck without this enhancement being discussed here.

why can’t the operator do that?

personally i don’t want to use specific CLI’s if i can teach my dev’s and op’s to use yaml files for kubernetes