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

backup/restore phases for async plugin operations #5710

Merged
merged 1 commit into from
Jan 3, 2023
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
4 changes: 4 additions & 0 deletions changelogs/unreleased/5710-sseago
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
new backup and restore phases to support async plugin operations:
- WaitingForPluginOperations
- WaitingForPluginOperationsPartiallyFailed

2 changes: 2 additions & 0 deletions config/crd/v1/bases/velero.io_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ spec:
- New
- FailedValidation
- InProgress
- WaitingForPluginOperations
- WaitingForPluginOperationsPartiallyFailed
- Completed
- PartiallyFailed
- Failed
Expand Down
2 changes: 2 additions & 0 deletions config/crd/v1/bases/velero.io_restores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ spec:
- New
- FailedValidation
- InProgress
- WaitingForPluginOperations
- WaitingForPluginOperationsPartiallyFailed
- Completed
- PartiallyFailed
- Failed
Expand Down
4 changes: 2 additions & 2 deletions config/crd/v1/crds/crds.go

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions pkg/apis/velero/v1/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const (

// BackupPhase is a string representation of the lifecycle phase
// of a Velero backup.
// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;Completed;PartiallyFailed;Failed;Deleting
// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;WaitingForPluginOperations;WaitingForPluginOperationsPartiallyFailed;Completed;PartiallyFailed;Failed;Deleting
type BackupPhase string

const (
Expand All @@ -236,16 +236,20 @@ const (
// BackupPhaseInProgress means the backup is currently executing.
BackupPhaseInProgress BackupPhase = "InProgress"

// BackupPhaseUploading means the backups of Kubernetes resources
// and creation of snapshots was successful and snapshot data
// is currently uploading. The backup is not usable yet.
BackupPhaseUploading BackupPhase = "Uploading"

// BackupPhaseUploadingPartialFailure means the backup of Kubernetes
// resources and creation of snapshots partially failed (final phase
// will be PartiallyFailed) and snapshot data is currently uploading.
// The backup is not usable yet.
BackupPhaseUploadingPartialFailure BackupPhase = "UploadingPartialFailure"
// BackupPhaseWaitingForPluginOperations means the backup of
// Kubernetes resources, creation of snapshots, and other
// async plugin operations was successful and snapshot data is
// currently uploading or other plugin operations are still
// ongoing. The backup is not usable yet.
BackupPhaseWaitingForPluginOperations BackupPhase = "WaitingForPluginOperations"

// BackupPhaseWaitingForPluginOperationsPartiallyFailed means
// the backup of Kubernetes resources, creation of snapshots,
// and other async plugin operations partially failed (final
// phase will be PartiallyFailed) and snapshot data is
// currently uploading or other plugin operations are still
// ongoing. The backup is not usable yet.
BackupPhaseWaitingForPluginOperationsPartiallyFailed BackupPhase = "WaitingForPluginOperationsPartiallyFailed"

// BackupPhaseCompleted means the backup has run successfully without
// errors.
Expand Down
15 changes: 14 additions & 1 deletion pkg/apis/velero/v1/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ type InitRestoreHook struct {

// RestorePhase is a string representation of the lifecycle phase
// of a Velero restore
// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;Completed;PartiallyFailed;Failed
// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;WaitingForPluginOperations;WaitingForPluginOperationsPartiallyFailed;Completed;PartiallyFailed;Failed
type RestorePhase string

const (
Expand All @@ -235,6 +235,19 @@ const (
// RestorePhaseInProgress means the restore is currently executing.
RestorePhaseInProgress RestorePhase = "InProgress"

// RestorePhaseWaitingForPluginOperations means the restore of
// Kubernetes resources and other async plugin operations was
// successful and plugin operations are still ongoing. The
// restore is not complete yet.
RestorePhaseWaitingForPluginOperations RestorePhase = "WaitingForPluginOperations"

// RestorePhaseWaitingForPluginOperationsPartiallyFailed means
// the restore of Kubernetes resources and other async plugin
// operations partially failed (final phase will be
// PartiallyFailed) and other plugin operations are still
// ongoing. The restore is not complete yet.
RestorePhaseWaitingForPluginOperationsPartiallyFailed RestorePhase = "WaitingForPluginOperationsPartiallyFailed"

// RestorePhaseCompleted means the restore has run successfully
// without errors.
RestorePhaseCompleted RestorePhase = "Completed"
Expand Down
4 changes: 3 additions & 1 deletion site/content/docs/main/api-types/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ status:
version: 1
# The date and time when the Backup is eligible for garbage collection.
expiration: null
# The current phase. Valid values are New, FailedValidation, InProgress, Completed, PartiallyFailed, Failed.
# The current phase.
# Valid values are New, FailedValidation, InProgress, WaitingForPluginOperations,
# WaitingForPluginOperationsPartiallyFailed, Completed, PartiallyFailed, Failed.
phase: ""
# An array of any validation errors encountered.
validationErrors: null
Expand Down
4 changes: 3 additions & 1 deletion site/content/docs/main/api-types/restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ spec:
onError: Continue
# RestoreStatus captures the current status of a Velero restore. Users should not set any data here.
status:
# The current phase. Valid values are New, FailedValidation, InProgress, Completed, PartiallyFailed, Failed.
# The current phase.
# Valid values are New, FailedValidation, InProgress, WaitingForPluginOperations,
# WaitingForPluginOperationsPartiallyFailed, Completed, PartiallyFailed, Failed.
phase: ""
# An array of any validation errors encountered.
validationErrors: null
Expand Down
3 changes: 2 additions & 1 deletion site/content/docs/main/api-types/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ spec:
post:
# Same content as pre above.
status:
# The current phase of the latest scheduled backup. Valid values are New, FailedValidation, InProgress, Completed, PartiallyFailed, Failed.
# The current phase.
# Valid values are New, Enabled, FailedValidation.
phase: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sseago I believe this phase is the current phase of the schedule and not backup. Schedule phase is different from backup phase https://github.com/vmware-tanzu/velero/blob/main/pkg/apis/velero/v1/schedule_types.go#L67

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham-pampattiwar Oh, you're right The doc is wrong here -- it says that phase is the phase of the backup, but it's not, it's hte schedule phase. I'll update the comments to reflect this.

# Date/time of the last backup for a given schedule
lastBackup:
Expand Down