From 8c2a07b9068b394664e5afae1e3a42ab3b631882 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 17 Feb 2022 10:13:28 +0800 Subject: [PATCH] Update --use-owner-references-in-backup description in velero command line Specify the risk of this parameter set to true. Add the issue first reported about this topic which includeds the google document illustrates about it. Signed-off-by: Xun Jiang --- changelogs/unreleased/4660-jxun | 1 + pkg/cmd/cli/schedule/create.go | 2 +- site/content/docs/main/backup-reference.md | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/4660-jxun diff --git a/changelogs/unreleased/4660-jxun b/changelogs/unreleased/4660-jxun new file mode 100644 index 000000000..cf09ca08e --- /dev/null +++ b/changelogs/unreleased/4660-jxun @@ -0,0 +1 @@ +Update --use-owner-references-in-backup description in velero command line. \ No newline at end of file diff --git a/pkg/cmd/cli/schedule/create.go b/pkg/cmd/cli/schedule/create.go index 5e15ac6bc..c5fe9398c 100644 --- a/pkg/cmd/cli/schedule/create.go +++ b/pkg/cmd/cli/schedule/create.go @@ -95,7 +95,7 @@ func NewCreateOptions() *CreateOptions { func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) { o.BackupOptions.BindFlags(flags) flags.StringVar(&o.Schedule, "schedule", o.Schedule, "A cron expression specifying a recurring schedule for this backup to run") - flags.BoolVar(&o.UseOwnerReferencesInBackup, "use-owner-references-in-backup", o.UseOwnerReferencesInBackup, "Specifies whether to use OwnerReferences on backups created by this Schedule") + flags.BoolVar(&o.UseOwnerReferencesInBackup, "use-owner-references-in-backup", o.UseOwnerReferencesInBackup, "Specifies whether to use OwnerReferences on backups created by this Schedule. Notice: if set to true, when schedule is deleted, backups will be deleted too.") } func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Factory) error { diff --git a/site/content/docs/main/backup-reference.md b/site/content/docs/main/backup-reference.md index 60e019188..06fdc07b8 100644 --- a/site/content/docs/main/backup-reference.md +++ b/site/content/docs/main/backup-reference.md @@ -61,6 +61,20 @@ velero backup create --from-schedule example-schedule This command will immediately trigger a new backup based on your template for `example-schedule`. This will not affect the backup schedule, and another backup will trigger at the scheduled time. + +### Limitation +Backups created from schedule can have owner reference to the schedule. This can be achieved by command: + +``` +velero schedule create --use-owner-references-in-backup +``` +By this way, schedule is the owner of it created backups. This is useful for some GitOps scenarios, or the resource tree of k8s synchronized from other places. + +Please do notice there is also side effect that may not be expected. Because schedule is the owner, when the schedule is deleted, the related backups CR (Just backup CR is deleted. Backup data still exists in object store and snapshots) will be deleted by k8s GC controller, too, but Velero controller will sync these backups from object store's metadata into k8s. Then k8s GC controller and Velero controller will fight over whether these backups should exist all through. + +If there is possibility the schedule will be disable to not create backup anymore, and the created backups are still useful. Please do not enable this option. For detail, please reference to [Backups created by a schedule with useOwnerReferenceInBackup set do not get synced properly](https://github.com/vmware-tanzu/velero/issues/4093). + + ## Kubernetes API Pagination By default, Velero will paginate the LIST API call for each resource type in the Kubernetes API when collecting items into a backup. The `--client-page-size` flag for the Velero server configures the size of each page.