Skip to content

Commit

Permalink
issue: add flag to the schedule cmd to configure the `useOwnerReferen…
Browse files Browse the repository at this point in the history
…cesInBackup` option vmware-tanzu#3176 (vmware-tanzu#3182)

* resolve: vmware-tanzu#3176

Signed-off-by: matheusjuvelino <[email protected]>

* created changelog

Signed-off-by: matheusjuvelino <[email protected]>

* fixed use-owner-rferences-in-backup flag for use-owner-references-in-backup

Signed-off-by: matheusjuvelino <[email protected]>
  • Loading branch information
matheusjuvelino authored and dharmab committed May 25, 2021
1 parent 05e23bd commit 01926a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/3182-matheusjuvelino
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
issue: add flag to the schedule cmd to configure the `useOwnerReferencesInBackup` option #3176
9 changes: 6 additions & 3 deletions pkg/cmd/cli/schedule/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
},
}

Expand Down

0 comments on commit 01926a8

Please sign in to comment.