Merge pull request #9103 from shubham-pampattiwar/fix-backup-desc-cp
Run the E2E test on kind / build (push) Failing after 7m58s
Run the E2E test on kind / setup-test-matrix (push) Successful in 4s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 1m2s

[release-1.16] Fix missing defaultVolumesToFsBackup flag output in Velero describe backup cmd (#9056)
This commit is contained in:
Shubham Pampattiwar
2025-07-23 15:51:14 -07:00
committed by GitHub
5 changed files with 184 additions and 0 deletions
@@ -0,0 +1 @@
Fix missing defaultVolumesToFsBackup flag output in Velero describe backup cmd
@@ -0,0 +1 @@
Update "Default Volumes to Fs Backup" to "File System Backup (Default)"
+3
View File
@@ -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("File System Backup (Default):\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
File System Backup (Default): 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
File System Backup (Default): 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
File System Backup (Default): 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
File System Backup (Default): 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 {