feat: add delete sub-command for backup-location (#3073)

* feat: add delete sub-command for backup-location

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>

* Change to use kubebuilder/runtimecontroller API

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>

* fix get BSL by label doesn't work

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>

* Update changelog

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>

* Ordering by alphabet

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>

* Better example format for help message

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>

* Capital the comments

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
This commit is contained in:
JenTing Hsiao
2020-11-30 13:59:42 -05:00
committed by GitHub
parent a877354750
commit 7f2de65b5b
12 changed files with 198 additions and 72 deletions
+5 -6
View File
@@ -44,21 +44,20 @@ func NewCreateCommand(f client.Factory, use string) *cobra.Command {
c := &cobra.Command{
Use: use + " [RESTORE_NAME] [--from-backup BACKUP_NAME | --from-schedule SCHEDULE_NAME]",
Short: "Create a restore",
Example: ` # Create a restore named "restore-1" from backup "backup-1."
Example: ` # Create a restore named "restore-1" from backup "backup-1".
velero restore create restore-1 --from-backup backup-1
# Create a restore with a default name ("backup-1-<timestamp>") from backup "backup-1."
# Create a restore with a default name ("backup-1-<timestamp>") from backup "backup-1".
velero restore create --from-backup backup-1
# Create a restore from the latest successful backup triggered by schedule "schedule-1."
# Create a restore from the latest successful backup triggered by schedule "schedule-1".
velero restore create --from-schedule schedule-1
# Create a restore from the latest successful OR partially-failed backup triggered by schedule "schedule-1."
# Create a restore from the latest successful OR partially-failed backup triggered by schedule "schedule-1".
velero restore create --from-schedule schedule-1 --allow-partially-failed
# Create a restore for only persistentvolumeclaims and persistentvolumes within a backup.
velero restore create --from-backup backup-2 --include-resources persistentvolumeclaims,persistentvolumes
`,
velero restore create --from-backup backup-2 --include-resources persistentvolumeclaims,persistentvolumes`,
Args: cobra.MaximumNArgs(1),
Run: func(c *cobra.Command, args []string) {
cmd.CheckError(o.Complete(args, f))
+10 -11
View File
@@ -39,21 +39,20 @@ func NewDeleteCommand(f client.Factory, use string) *cobra.Command {
c := &cobra.Command{
Use: fmt.Sprintf("%s [NAMES]", use),
Short: "Delete restores",
Example: ` # Delete a restore named "restore-1."
velero restore delete restore-1
Example: ` # Delete a restore named "restore-1".
velero restore delete restore-1
# Delete a restore named "restore-1" without prompting for confirmation.
velero restore delete restore-1 --confirm
# Delete a restore named "restore-1" without prompting for confirmation.
velero restore delete restore-1 --confirm
# Delete restores named "restore-1" and "restore-2."
velero restore delete restore-1 restore-2
# Delete restores named "restore-1" and "restore-2".
velero restore delete restore-1 restore-2
# Delete all restores labelled with foo=bar."
velero restore delete --selector foo=bar
# Delete all restores labelled with "foo=bar".
velero restore delete --selector foo=bar
# Delete all restores.
velero restore delete --all`,
# Delete all restores.
velero restore delete --all`,
Run: func(c *cobra.Command, args []string) {
cmd.CheckError(o.Complete(f, args))
cmd.CheckError(o.Validate(c, f, args))