From e2d6809701b8764d3b362840bc2af111a3598900 Mon Sep 17 00:00:00 2001 From: matheusjuvelino Date: Mon, 14 Dec 2020 21:30:35 -0300 Subject: [PATCH] issue: add flag to the schedule cmd to configure the `useOwnerReferencesInBackup` option #3176 (#3182) * resolve: #3176 Signed-off-by: matheusjuvelino * created changelog Signed-off-by: matheusjuvelino * fixed use-owner-rferences-in-backup flag for use-owner-references-in-backup Signed-off-by: matheusjuvelino --- changelogs/unreleased/3182-matheusjuvelino | 1 + pkg/cmd/cli/schedule/create.go | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/3182-matheusjuvelino diff --git a/changelogs/unreleased/3182-matheusjuvelino b/changelogs/unreleased/3182-matheusjuvelino new file mode 100644 index 0000000000..7e6768ac2d --- /dev/null +++ b/changelogs/unreleased/3182-matheusjuvelino @@ -0,0 +1 @@ +issue: add flag to the schedule cmd to configure the `useOwnerReferencesInBackup` option #3176 \ No newline at end of file diff --git a/pkg/cmd/cli/schedule/create.go b/pkg/cmd/cli/schedule/create.go index 7604c2c75e..e09cb0bea5 100644 --- a/pkg/cmd/cli/schedule/create.go +++ b/pkg/cmd/cli/schedule/create.go @@ -79,8 +79,9 @@ example: "@every 2h30m".`, } type CreateOptions struct { - BackupOptions *backup.CreateOptions - Schedule string + BackupOptions *backup.CreateOptions + Schedule string + UseOwnerReferencesInBackup bool labelSelector *metav1.LabelSelector } @@ -94,6 +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") } func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Factory) error { @@ -134,7 +136,8 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error { VolumeSnapshotLocations: o.BackupOptions.SnapshotLocations, DefaultVolumesToRestic: o.BackupOptions.DefaultVolumesToRestic.Value, }, - Schedule: o.Schedule, + Schedule: o.Schedule, + UseOwnerReferencesInBackup: &o.UseOwnerReferencesInBackup, }, }