mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 13:05:17 +00:00
add default restic flag to backup create cli
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
This commit is contained in:
@@ -128,6 +128,12 @@ func (b *BackupBuilder) SnapshotVolumes(val bool) *BackupBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
// DefaultRestic sets the Backup's "DefaultRestic" flag.
|
||||
func (b *BackupBuilder) DefaultRestic(val bool) *BackupBuilder {
|
||||
b.object.Spec.DefaultRestic = &val
|
||||
return b
|
||||
}
|
||||
|
||||
// Phase sets the Backup's phase.
|
||||
func (b *BackupBuilder) Phase(phase velerov1api.BackupPhase) *BackupBuilder {
|
||||
b.object.Status.Phase = phase
|
||||
|
||||
@@ -81,6 +81,7 @@ type CreateOptions struct {
|
||||
Name string
|
||||
TTL time.Duration
|
||||
SnapshotVolumes flag.OptionalBool
|
||||
DefaultRestic flag.OptionalBool
|
||||
IncludeNamespaces flag.StringArray
|
||||
ExcludeNamespaces flag.StringArray
|
||||
IncludeResources flag.StringArray
|
||||
@@ -123,6 +124,9 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
|
||||
|
||||
f = flags.VarPF(&o.IncludeClusterResources, "include-cluster-resources", "", "include cluster-scoped resources in the backup")
|
||||
f.NoOptDefVal = "true"
|
||||
|
||||
f = flags.VarPF(&o.DefaultRestic, "default-restic", "", "use restic by default to backup all pod volumes")
|
||||
f.NoOptDefVal = "true"
|
||||
}
|
||||
|
||||
// BindWait binds the wait flag separately so it is not called by other create
|
||||
@@ -295,6 +299,9 @@ func (o *CreateOptions) BuildBackup(namespace string) (*velerov1api.Backup, erro
|
||||
if o.IncludeClusterResources.Value != nil {
|
||||
backupBuilder.IncludeClusterResources(*o.IncludeClusterResources.Value)
|
||||
}
|
||||
if o.DefaultRestic.Value != nil {
|
||||
backupBuilder.DefaultRestic(*o.DefaultRestic.Value)
|
||||
}
|
||||
}
|
||||
|
||||
backup := backupBuilder.ObjectMeta(builder.WithLabelsMap(o.Labels.Data())).Result()
|
||||
|
||||
Reference in New Issue
Block a user