Skip to content

Commit

Permalink
restore progress reporting
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
  • Loading branch information
pranavgaikwad committed Feb 5, 2021
1 parent 1fd49f4 commit c09035c
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 80 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/3125-pranavgaikwad
@@ -0,0 +1 @@
Restore progress reporting
16 changes: 16 additions & 0 deletions config/crd/bases/velero.io_restores.yaml
Expand Up @@ -1651,6 +1651,22 @@ spec:
- PartiallyFailed
- Failed
type: string
progress:
description: Progress contains information about the restore's execution
progress. Note that this information is best-effort only -- if Velero
fails to update it during a restore for any reason, it may be inaccurate/stale.
nullable: true
properties:
itemsRestored:
description: ItemsRestored is the number of items that have actually
been restored so far
type: integer
totalItems:
description: TotalItems is the total number of items to be restored.
This number may change throughout the execution of the restore
due to plugins that return additional related items to restore
type: integer
type: object
startTimestamp:
description: StartTimestamp records the time the restore operation was
started. The server's time is used for StartTimestamps
Expand Down
2 changes: 1 addition & 1 deletion config/crd/crds/crds.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions pkg/apis/velero/v1/restore.go
Expand Up @@ -252,6 +252,25 @@ type RestoreStatus struct {
// +optional
// +nullable
CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

// Progress contains information about the restore's execution progress. Note
// that this information is best-effort only -- if Velero fails to update it
// during a restore for any reason, it may be inaccurate/stale.
// +optional
// +nullable
Progress *RestoreProgress `json:"progress,omitempty"`
}

// RestoreProgress stores information about the restore's execution progress
type RestoreProgress struct {
// TotalItems is the total number of items to be restored. This number may change
// throughout the execution of the restore due to plugins that return additional related
// items to restore
// +optional
TotalItems int `json:"totalItems,omitempty"`
// ItemsRestored is the number of items that have actually been restored so far
// +optional
ItemsRestored int `json:"itemsRestored,omitempty"`
}

// +genclient
Expand Down
21 changes: 21 additions & 0 deletions pkg/apis/velero/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/cmd/server/server.go
Expand Up @@ -688,6 +688,7 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string

restoreControllerRunInfo := func() controllerRunInfo {
restorer, err := restore.NewKubernetesRestorer(
s.veleroClient.VeleroV1(),
s.discoveryHelper,
client.NewDynamicFactory(s.dynamicClient),
s.config.restoreResourcePriorities,
Expand Down

0 comments on commit c09035c

Please sign in to comment.