vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.71k stars 1.4k forks source link

Velero command not throwing and error when schedule hasn't been correctly defined #8214

Open jeremyvdveen opened 1 month ago

jeremyvdveen commented 1 month ago

What steps did you take and what happened:

When running the command velero create backup --from-schedule= test I would suspect the command to fail, because there is a space between the = character and the name of the schedule. However, when I run this command Velero just creates a back-up with the name of the schedule as the name of the back-up. This is undesirable in my situation, because it will cause Velero to back-up items that have been excluded in my schedule.

What did you expect to happen: I would suspect the command to fail, because there is a space between the = character and the name of the schedule. The following information will help us better understand what's going on:

Environment:

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.

sseago commented 1 month ago

The reason it creates a backup with the name "test" is that test is the only arg given that's not connected to a flag, which is how Velero knows what you want to call the backup. I imagine the fix here would probably be to augment the from-schedule validation to error out if from-schedule is specified but the value is "". I'm not 100% sure that's possible with the cli framework we're using, though -- it might just appear to velero that from-schedule was omitted.

jeremyvdveen commented 1 month ago

That sounds to me like a good solution, but I can't speak on if that is a supported by the framework that is being used.

jeremyvdveen commented 1 month ago

An alternative solution might be adding a rule to the Velero server that prevents making back-ups that are not based on a schedule. This rule should than of course be configurable by the admin deploying the server. If both solutions don't work, than the final solution I can come up with to my specific problem is to have a global list of excluded resources.