Skip to content

Commit

Permalink
Track the skipped PV in a backup and print the summary in backup log (#…
Browse files Browse the repository at this point in the history
…6496)

Partially address the requirements in #5834

Signed-off-by: Daniel Jiang <[email protected]>
  • Loading branch information
reasonerjt authored Jul 20, 2023
1 parent b4181ef commit 2548b20
Show file tree
Hide file tree
Showing 16 changed files with 816 additions and 127 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/6496-reasonerjt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Track the skipped PVC and print the summary in backup log
16 changes: 9 additions & 7 deletions pkg/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,9 @@ func (kb *kubernetesBackupper) BackupWithResolvers(log logrus.FieldLogger,
if err := kube.PatchResource(backupRequest.Backup, updated, kb.kbClient); err != nil {
log.WithError(errors.WithStack((err))).Warn("Got error trying to update backup's status.progress")
}
skippedPVSummary, _ := json.Marshal(backupRequest.SkippedPVTracker.Summary())
log.Infof("Summary for skipped PVs: %s", skippedPVSummary)
backupRequest.Status.Progress = &velerov1api.BackupProgress{TotalItems: len(backupRequest.BackedUpItems), ItemsBackedUp: len(backupRequest.BackedUpItems)}

log.WithField("progress", "").Infof("Backed up a total of %d items", len(backupRequest.BackedUpItems))

return nil
Expand Down Expand Up @@ -590,12 +591,13 @@ func (kb *kubernetesBackupper) FinalizeBackup(log logrus.FieldLogger,
log.WithField("progress", "").Infof("Collected %d items from the async BIA operations PostOperationItems list", len(items))

itemBackupper := &itemBackupper{
backupRequest: backupRequest,
tarWriter: tw,
dynamicFactory: kb.dynamicFactory,
kbClient: kb.kbClient,
discoveryHelper: kb.discoveryHelper,
itemHookHandler: &hook.NoOpItemHookHandler{},
backupRequest: backupRequest,
tarWriter: tw,
dynamicFactory: kb.dynamicFactory,
kbClient: kb.kbClient,
discoveryHelper: kb.discoveryHelper,
itemHookHandler: &hook.NoOpItemHookHandler{},
podVolumeSnapshotTracker: newPVCSnapshotTracker(),
}
updateFiles := make(map[string]FileForArchive)
backedUpGroupResources := map[schema.GroupResource]bool{}
Expand Down
Loading

0 comments on commit 2548b20

Please sign in to comment.