Support pause/unpause schedules

Support pause/unpause schedule

Fixes #2363

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
This commit is contained in:
Wenkai Yin(尹文开)
2022-09-15 10:42:48 +08:00
parent 100d6b4430
commit 4b9dbfa416
21 changed files with 440 additions and 89 deletions
+3
View File
@@ -82,6 +82,7 @@ type CreateOptions struct {
BackupOptions *backup.CreateOptions
Schedule string
UseOwnerReferencesInBackup bool
Paused bool
labelSelector *metav1.LabelSelector
}
@@ -96,6 +97,7 @@ 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. Notice: if set to true, when schedule is deleted, backups will be deleted too.")
flags.BoolVar(&o.Paused, "paused", o.Paused, "Specifies whether the newly created schedule is paused or not.")
}
func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Factory) error {
@@ -149,6 +151,7 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
},
Schedule: o.Schedule,
UseOwnerReferencesInBackup: &o.UseOwnerReferencesInBackup,
Paused: o.Paused,
},
}