issue: add flag to the schedule cmd to configure the useOwnerReferencesInBackup option #3176 (#3182)

* resolve: #3176

Signed-off-by: matheusjuvelino <matheus.juvelino@outlook.com>

* created changelog

Signed-off-by: matheusjuvelino <matheus.juvelino@outlook.com>

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

Signed-off-by: matheusjuvelino <matheus.juvelino@outlook.com>
This commit is contained in:
matheusjuvelino
2020-12-14 21:30:35 -03:00
committed by GitHub
parent 2f635e14ce
commit 73693de5a3
2 changed files with 7 additions and 3 deletions

View File

@@ -0,0 +1 @@
issue: add flag to the schedule cmd to configure the `useOwnerReferencesInBackup` option #3176

View File

@@ -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,
},
}