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
+9 -10
View File
@@ -1,5 +1,5 @@
/*
Copyright 2017 the Velero contributors.
Copyright 2020 the Velero contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -52,18 +52,17 @@ The schedule can also be expressed using "@every <duration>" syntax. The duratio
can be specified using a combination of seconds (s), minutes (m), and hours (h), for
example: "@every 2h30m".`,
Example: ` # Create a backup every 6 hours
velero create schedule NAME --schedule="0 */6 * * *"
Example: ` # Create a backup every 6 hours.
velero create schedule NAME --schedule="0 */6 * * *"
# Create a backup every 6 hours with the @every notation
velero create schedule NAME --schedule="@every 6h"
# Create a backup every 6 hours with the @every notation.
velero create schedule NAME --schedule="@every 6h"
# Create a daily backup of the web namespace
velero create schedule NAME --schedule="@every 24h" --include-namespaces web
# Create a daily backup of the web namespace.
velero create schedule NAME --schedule="@every 24h" --include-namespaces web
# Create a weekly backup, each living for 90 days (2160 hours)
velero create schedule NAME --schedule="@every 168h" --ttl 2160h0m0s
`,
# Create a weekly backup, each living for 90 days (2160 hours).
velero create schedule NAME --schedule="@every 168h" --ttl 2160h0m0s`,
Args: cobra.ExactArgs(1),
Run: func(c *cobra.Command, args []string) {
cmd.CheckError(o.Complete(args, f))
+13 -14
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 schedules",
Example: ` # Delete a schedule named "schedule-1."
velero schedule delete schedule-1
# Delete a schedule named "schedule-1" without prompting for confirmation.
velero schedule delete schedule-1 --confirm
# Delete schedules named "schedule-1" and "schedule-2."
velero schedule delete schedule-1 schedule-2
# Delete all schedules labelled with foo=bar."
velero schedule delete --selector foo=bar
# Delete all schedules.
velero schedule delete --all`,
Example: ` # Delete a schedule named "schedule-1".
velero schedule delete schedule-1
# Delete a schedule named "schedule-1" without prompting for confirmation.
velero schedule delete schedule-1 --confirm
# Delete schedules named "schedule-1" and "schedule-2".
velero schedule delete schedule-1 schedule-2
# Delete all schedules labelled with "foo=bar".
velero schedule delete --selector foo=bar
# Delete all schedules.
velero schedule delete --all`,
Run: func(c *cobra.Command, args []string) {
cmd.CheckError(o.Complete(f, args))
cmd.CheckError(o.Validate(c, f, args))