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
+12 -12
View File
@@ -53,23 +53,23 @@ func NewCreateCommand(f client.Factory, use string) *cobra.Command {
cmd.CheckError(o.Validate(c, args, f))
cmd.CheckError(o.Run(c, f))
},
Example: ` # Create a backup containing all resources.
velero backup create backup1
Example: ` # Create a backup containing all resources.
velero backup create backup1
# Create a backup including only the nginx namespace.
velero backup create nginx-backup --include-namespaces nginx
# Create a backup including only the nginx namespace.
velero backup create nginx-backup --include-namespaces nginx
# Create a backup excluding the velero and default namespaces.
velero backup create backup2 --exclude-namespaces velero,default
# Create a backup excluding the velero and default namespaces.
velero backup create backup2 --exclude-namespaces velero,default
# Create a backup based on a schedule named daily-backup.
velero backup create --from-schedule daily-backup
# Create a backup based on a schedule named daily-backup.
velero backup create --from-schedule daily-backup
# View the YAML for a backup that doesn't snapshot volumes, without sending it to the server.
velero backup create backup3 --snapshot-volumes=false -o yaml
# View the YAML for a backup that doesn't snapshot volumes, without sending it to the server.
velero backup create backup3 --snapshot-volumes=false -o yaml
# Wait for a backup to complete before returning from the command.
velero backup create backup4 --wait`,
# Wait for a backup to complete before returning from the command.
velero backup create backup4 --wait`,
}
o.BindFlags(c.Flags())
+4 -5
View File
@@ -40,21 +40,20 @@ func NewDeleteCommand(f client.Factory, use string) *cobra.Command {
c := &cobra.Command{
Use: fmt.Sprintf("%s [NAMES]", use),
Short: "Delete backups",
Example: ` # Delete a backup named "backup-1."
Example: ` # Delete a backup named "backup-1".
velero backup delete backup-1
# Delete a backup named "backup-1" without prompting for confirmation.
velero backup delete backup-1 --confirm
# Delete backups named "backup-1" and "backup-2."
# Delete backups named "backup-1" and "backup-2".
velero backup delete backup-1 backup-2
# Delete all backups triggered by schedule "schedule-1."
# Delete all backups triggered by schedule "schedule-1".
velero backup delete --selector velero.io/schedule-name=schedule-1
# Delete all backups.
velero backup delete --all
`,
velero backup delete --all`,
Run: func(c *cobra.Command, args []string) {
cmd.CheckError(o.Complete(f, args))
cmd.CheckError(o.Validate(c, f, args))