Add data mover related options in CLI
Add data mover related options in CLI Fixes #6128 Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>pull/6365/head
parent
ad8f69bcb1
commit
9f2f563568
|
@ -0,0 +1 @@
|
|||
Add data mover related options in CLI
|
|
@ -287,3 +287,15 @@ func (b *BackupBuilder) ResourcePolicies(name string) *BackupBuilder {
|
|||
b.object.Spec.ResourcePolicy = &v1.TypedLocalObjectReference{Kind: resourcepolicies.ConfigmapRefType, Name: name}
|
||||
return b
|
||||
}
|
||||
|
||||
// SnapshotMoveData sets the Backup's "snapshot move data" flag.
|
||||
func (b *BackupBuilder) SnapshotMoveData(val bool) *BackupBuilder {
|
||||
b.object.Spec.SnapshotMoveData = &val
|
||||
return b
|
||||
}
|
||||
|
||||
// DataMover sets the Backup's data mover
|
||||
func (b *BackupBuilder) DataMover(name string) *BackupBuilder {
|
||||
b.object.Spec.DataMover = name
|
||||
return b
|
||||
}
|
||||
|
|
|
@ -85,6 +85,8 @@ type CreateOptions struct {
|
|||
Name string
|
||||
TTL time.Duration
|
||||
SnapshotVolumes flag.OptionalBool
|
||||
SnapshotMoveData flag.OptionalBool
|
||||
DataMover string
|
||||
DefaultVolumesToFsBackup flag.OptionalBool
|
||||
IncludeNamespaces flag.StringArray
|
||||
ExcludeNamespaces flag.StringArray
|
||||
|
@ -139,6 +141,9 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
|
|||
// like a normal bool flag
|
||||
f.NoOptDefVal = "true"
|
||||
|
||||
f = flags.VarPF(&o.SnapshotMoveData, "snapshot-move-data", "", "Specify whether snapshot data should be moved")
|
||||
f.NoOptDefVal = "true"
|
||||
|
||||
f = flags.VarPF(&o.IncludeClusterResources, "include-cluster-resources", "", "Include cluster-scoped resources in the backup. Cannot work with include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources.")
|
||||
f.NoOptDefVal = "true"
|
||||
|
||||
|
@ -146,6 +151,7 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
|
|||
f.NoOptDefVal = "true"
|
||||
|
||||
flags.StringVar(&o.ResPoliciesConfigmap, "resource-policies-configmap", "", "Reference to the resource policies configmap that backup using")
|
||||
flags.StringVar(&o.DataMover, "data-mover", "", "Specify the data mover to be used by the backup. If the parameter is not set or set as 'velero', the built-in data mover will be used")
|
||||
}
|
||||
|
||||
// BindWait binds the wait flag separately so it is not called by other create
|
||||
|
@ -359,7 +365,8 @@ func (o *CreateOptions) BuildBackup(namespace string) (*velerov1api.Backup, erro
|
|||
StorageLocation(o.StorageLocation).
|
||||
VolumeSnapshotLocations(o.SnapshotLocations...).
|
||||
CSISnapshotTimeout(o.CSISnapshotTimeout).
|
||||
ItemOperationTimeout(o.ItemOperationTimeout)
|
||||
ItemOperationTimeout(o.ItemOperationTimeout).
|
||||
DataMover(o.DataMover)
|
||||
if len(o.OrderedResources) > 0 {
|
||||
orders, err := ParseOrderedResources(o.OrderedResources)
|
||||
if err != nil {
|
||||
|
@ -371,6 +378,9 @@ func (o *CreateOptions) BuildBackup(namespace string) (*velerov1api.Backup, erro
|
|||
if o.SnapshotVolumes.Value != nil {
|
||||
backupBuilder.SnapshotVolumes(*o.SnapshotVolumes.Value)
|
||||
}
|
||||
if o.SnapshotMoveData.Value != nil {
|
||||
backupBuilder.SnapshotMoveData(*o.SnapshotMoveData.Value)
|
||||
}
|
||||
if o.IncludeClusterResources.Value != nil {
|
||||
backupBuilder.IncludeClusterResources(*o.IncludeClusterResources.Value)
|
||||
}
|
||||
|
|
|
@ -206,6 +206,13 @@ func DescribeBackupSpec(d *Describer, spec velerov1api.BackupSpec) {
|
|||
|
||||
d.Println()
|
||||
d.Printf("Velero-Native Snapshot PVs:\t%s\n", BoolPointerString(spec.SnapshotVolumes, "false", "true", "auto"))
|
||||
d.Printf("Snapshot Move Data:\t%s\n", BoolPointerString(spec.SnapshotMoveData, "false", "true", "auto"))
|
||||
if len(spec.DataMover) == 0 {
|
||||
s = emptyDisplay
|
||||
} else {
|
||||
s = spec.DataMover
|
||||
}
|
||||
d.Printf("Data Mover:\t%s\n", s)
|
||||
|
||||
d.Println()
|
||||
d.Printf("TTL:\t%s\n", spec.TTL.Duration)
|
||||
|
|
|
@ -137,6 +137,15 @@ func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec)
|
|||
|
||||
// describe snapshot volumes
|
||||
backupSpecInfo["veleroNativeSnapshotPVs"] = BoolPointerString(spec.SnapshotVolumes, "false", "true", "auto")
|
||||
// describe snapshot move data
|
||||
backupSpecInfo["veleroSnapshotMoveData"] = BoolPointerString(spec.SnapshotMoveData, "false", "true", "auto")
|
||||
// describe data mover
|
||||
if len(spec.DataMover) == 0 {
|
||||
s = emptyDisplay
|
||||
} else {
|
||||
s = spec.DataMover
|
||||
}
|
||||
backupSpecInfo["dataMover"] = s
|
||||
|
||||
// describe TTL
|
||||
backupSpecInfo["TTL"] = spec.TTL.Duration.String()
|
||||
|
|
Loading…
Reference in New Issue