mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 13:05:17 +00:00
Fix missing defaultVolumesToFsBackup flag output in Velero describe backup cmd (#9056)
add changelog file Show defaultVolumesToFsBackup in describe only when set by the user minor ut fix minor fix Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
This commit is contained in:
committed by
GitHub
parent
9113f17c3b
commit
60a6c7384f
@@ -217,6 +217,9 @@ func DescribeBackupSpec(d *Describer, spec velerov1api.BackupSpec) {
|
||||
|
||||
d.Println()
|
||||
d.Printf("Velero-Native Snapshot PVs:\t%s\n", BoolPointerString(spec.SnapshotVolumes, "false", "true", "auto"))
|
||||
if spec.DefaultVolumesToFsBackup != nil {
|
||||
d.Printf("Default Volumes to Fs Backup:\t%s\n", BoolPointerString(spec.DefaultVolumesToFsBackup, "false", "true", ""))
|
||||
}
|
||||
d.Printf("Snapshot Move Data:\t%s\n", BoolPointerString(spec.SnapshotMoveData, "false", "true", "auto"))
|
||||
if len(spec.DataMover) == 0 {
|
||||
s = defaultDataMover
|
||||
|
||||
@@ -281,6 +281,71 @@ Hooks:
|
||||
|
||||
OrderedResources:
|
||||
kind1: rs1-1, rs1-2
|
||||
`
|
||||
input4 := builder.ForBackup("test-ns", "test-backup-4").
|
||||
DefaultVolumesToFsBackup(true).
|
||||
StorageLocation("backup-location").
|
||||
Result().Spec
|
||||
|
||||
expect4 := `Namespaces:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
|
||||
Resources:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
Cluster-scoped: auto
|
||||
|
||||
Label selector: <none>
|
||||
|
||||
Or label selector: <none>
|
||||
|
||||
Storage Location: backup-location
|
||||
|
||||
Velero-Native Snapshot PVs: auto
|
||||
Default Volumes to Fs Backup: true
|
||||
Snapshot Move Data: auto
|
||||
Data Mover: velero
|
||||
|
||||
TTL: 0s
|
||||
|
||||
CSISnapshotTimeout: 0s
|
||||
ItemOperationTimeout: 0s
|
||||
|
||||
Hooks: <none>
|
||||
`
|
||||
|
||||
input5 := builder.ForBackup("test-ns", "test-backup-5").
|
||||
DefaultVolumesToFsBackup(false).
|
||||
StorageLocation("backup-location").
|
||||
Result().Spec
|
||||
|
||||
expect5 := `Namespaces:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
|
||||
Resources:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
Cluster-scoped: auto
|
||||
|
||||
Label selector: <none>
|
||||
|
||||
Or label selector: <none>
|
||||
|
||||
Storage Location: backup-location
|
||||
|
||||
Velero-Native Snapshot PVs: auto
|
||||
Default Volumes to Fs Backup: false
|
||||
Snapshot Move Data: auto
|
||||
Data Mover: velero
|
||||
|
||||
TTL: 0s
|
||||
|
||||
CSISnapshotTimeout: 0s
|
||||
ItemOperationTimeout: 0s
|
||||
|
||||
Hooks: <none>
|
||||
`
|
||||
|
||||
testcases := []struct {
|
||||
@@ -303,6 +368,16 @@ OrderedResources:
|
||||
input: input3,
|
||||
expect: expect3,
|
||||
},
|
||||
{
|
||||
name: "DefaultVolumesToFsBackup is true",
|
||||
input: input4,
|
||||
expect: expect4,
|
||||
},
|
||||
{
|
||||
name: "DefaultVolumesToFsBackup is false",
|
||||
input: input5,
|
||||
expect: expect5,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
|
||||
@@ -102,6 +102,100 @@ Backup Template:
|
||||
|
||||
Hooks: <none>
|
||||
|
||||
Last Backup: 2023-06-25 15:04:05 +0000 UTC
|
||||
`
|
||||
|
||||
input3 := builder.ForSchedule("velero", "schedule-3").
|
||||
Phase(velerov1api.SchedulePhaseEnabled).
|
||||
CronSchedule("0 0 * * *").
|
||||
Template(builder.ForBackup("velero", "backup-1").DefaultVolumesToFsBackup(true).Result().Spec).
|
||||
LastBackupTime("2023-06-25 15:04:05").Result()
|
||||
expect3 := `Name: schedule-3
|
||||
Namespace: velero
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
|
||||
Phase: Enabled
|
||||
|
||||
Paused: false
|
||||
|
||||
Schedule: 0 0 * * *
|
||||
|
||||
Backup Template:
|
||||
Namespaces:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
|
||||
Resources:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
Cluster-scoped: auto
|
||||
|
||||
Label selector: <none>
|
||||
|
||||
Or label selector: <none>
|
||||
|
||||
Storage Location:
|
||||
|
||||
Velero-Native Snapshot PVs: auto
|
||||
Default Volumes to Fs Backup: true
|
||||
Snapshot Move Data: auto
|
||||
Data Mover: velero
|
||||
|
||||
TTL: 0s
|
||||
|
||||
CSISnapshotTimeout: 0s
|
||||
ItemOperationTimeout: 0s
|
||||
|
||||
Hooks: <none>
|
||||
|
||||
Last Backup: 2023-06-25 15:04:05 +0000 UTC
|
||||
`
|
||||
|
||||
input4 := builder.ForSchedule("velero", "schedule-4").
|
||||
Phase(velerov1api.SchedulePhaseEnabled).
|
||||
CronSchedule("0 0 * * *").
|
||||
Template(builder.ForBackup("velero", "backup-1").DefaultVolumesToFsBackup(false).Result().Spec).
|
||||
LastBackupTime("2023-06-25 15:04:05").Result()
|
||||
expect4 := `Name: schedule-4
|
||||
Namespace: velero
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
|
||||
Phase: Enabled
|
||||
|
||||
Paused: false
|
||||
|
||||
Schedule: 0 0 * * *
|
||||
|
||||
Backup Template:
|
||||
Namespaces:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
|
||||
Resources:
|
||||
Included: *
|
||||
Excluded: <none>
|
||||
Cluster-scoped: auto
|
||||
|
||||
Label selector: <none>
|
||||
|
||||
Or label selector: <none>
|
||||
|
||||
Storage Location:
|
||||
|
||||
Velero-Native Snapshot PVs: auto
|
||||
Default Volumes to Fs Backup: false
|
||||
Snapshot Move Data: auto
|
||||
Data Mover: velero
|
||||
|
||||
TTL: 0s
|
||||
|
||||
CSISnapshotTimeout: 0s
|
||||
ItemOperationTimeout: 0s
|
||||
|
||||
Hooks: <none>
|
||||
|
||||
Last Backup: 2023-06-25 15:04:05 +0000 UTC
|
||||
`
|
||||
|
||||
@@ -120,6 +214,16 @@ Last Backup: 2023-06-25 15:04:05 +0000 UTC
|
||||
input: input2,
|
||||
expect: expect2,
|
||||
},
|
||||
{
|
||||
name: "schedule with DefaultVolumesToFsBackup is true",
|
||||
input: input3,
|
||||
expect: expect3,
|
||||
},
|
||||
{
|
||||
name: "schedule with DefaultVolumesToFsBackup is false",
|
||||
input: input4,
|
||||
expect: expect4,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
|
||||
Reference in New Issue
Block a user