Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change B/R describe CLI to support kopia #5412

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/unreleased/5412-allenxu404
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change B/R describe CLI to support Kopia
13 changes: 11 additions & 2 deletions pkg/cmd/util/output/backup_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,19 @@ func failedDeletionCount(requests []velerov1api.DeleteBackupRequest) int {

// DescribePodVolumeBackups describes pod volume backups in human-readable format.
func DescribePodVolumeBackups(d *Describer, backups []velerov1api.PodVolumeBackup, details bool) {
// Get the type of pod volume uploader. Since the uploader only comes from a single source, we can
// take the uploader type from the first element of the array.
var uploaderType string
if len(backups) > 0 {
uploaderType = backups[0].Spec.UploaderType
} else {
return
}

if details {
d.Printf("Restic Backups:\n")
d.Printf("%s Backups:\n", uploaderType)
} else {
d.Printf("Restic Backups (specify --details for more information):\n")
d.Printf("%s Backups (specify --details for more information):\n", uploaderType)
}

// separate backups by phase (combining <none> and New into a single group)
Expand Down
13 changes: 11 additions & 2 deletions pkg/cmd/util/output/restore_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,19 @@ func describeRestoreResult(d *Describer, name string, result pkgrestore.Result)

// describePodVolumeRestores describes pod volume restores in human-readable format.
func describePodVolumeRestores(d *Describer, restores []velerov1api.PodVolumeRestore, details bool) {
// Get the type of pod volume uploader. Since the uploader only comes from a single source, we can
// take the uploader type from the first element of the array.
var uploaderType string
if len(restores) > 0 {
uploaderType = restores[0].Spec.UploaderType
} else {
return
}

if details {
d.Printf("Restic Restores:\n")
d.Printf("%s Restores:\n", uploaderType)
} else {
d.Printf("Restic Restores (specify --details for more information):\n")
d.Printf("%s Restores (specify --details for more information):\n", uploaderType)
}

// separate restores by phase (combining <none> and New into a single group)
Expand Down