mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-20 06:54:32 +00:00
Move falling back full restore logic from PVC CSI RIA to data mover (#10541)
e2e-test-kind.yaml / extract (push) Failing after 6s
Run the E2E test on kind / get-go-version (push) Failing after 7s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / setup-test-matrix (push) Failing after 2s
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 5s
Scorecard supply-chain security / Scorecard analysis (push) Skipped
Main CI / get-go-version (push) Failing after 6s
Main CI / Build (push) Skipped
e2e-test-kind.yaml / extract (push) Failing after 6s
Run the E2E test on kind / get-go-version (push) Failing after 7s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / setup-test-matrix (push) Failing after 2s
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 5s
Scorecard supply-chain security / Scorecard analysis (push) Skipped
Main CI / get-go-version (push) Failing after 6s
Main CI / Build (push) Skipped
Move falling back full restore logic from PVC CSI RIA to data mover Signed-off-by: Wenkai Yin (尹文开) <wenkai.yin@broadcom.com>
This commit is contained in:
@@ -21,11 +21,16 @@ spec:
|
||||
jsonPath: .status.phase
|
||||
name: Status
|
||||
type: string
|
||||
- description: Restore type such as Full/Incremental
|
||||
- description: Requested restore type such as Full/Incremental
|
||||
jsonPath: .spec.restoreType
|
||||
name: Restore Type
|
||||
name: Requested Restore Type
|
||||
priority: 10
|
||||
type: string
|
||||
- description: Whether the incremental restore has fallen back to full restore
|
||||
jsonPath: .status.fallbackFull
|
||||
name: Fallback Full
|
||||
priority: 10
|
||||
type: boolean
|
||||
- description: Time duration since this DataDownload was started
|
||||
jsonPath: .status.startTimestamp
|
||||
name: Started
|
||||
|
||||
@@ -162,7 +162,8 @@ type DataDownloadStatus struct {
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="DataDownload status such as New/InProgress"
|
||||
// The "Restore Type" column is hidden by default to align with DataUpload.
|
||||
// +kubebuilder:printcolumn:name="Restore Type",type="string",JSONPath=".spec.restoreType",description="Restore type such as Full/Incremental",priority=10
|
||||
// +kubebuilder:printcolumn:name="Requested Restore Type",type="string",JSONPath=".spec.restoreType",description="Requested restore type such as Full/Incremental",priority=10
|
||||
// +kubebuilder:printcolumn:name="Fallback Full",type="boolean",JSONPath=".status.fallbackFull",description="Whether the incremental restore has fallen back to full restore",priority=10
|
||||
// +kubebuilder:printcolumn:name="Started",type="date",JSONPath=".status.startTimestamp",description="Time duration since this DataDownload was started"
|
||||
// +kubebuilder:printcolumn:name="Bytes Done",type="integer",format="int64",JSONPath=".status.progress.bytesDone",description="Completed bytes"
|
||||
// +kubebuilder:printcolumn:name="Total Bytes",type="integer",format="int64",JSONPath=".status.progress.totalBytes",description="Total bytes"
|
||||
|
||||
@@ -244,7 +244,6 @@ func (p *pvcRestoreItemAction) executeWithDataMove(logger *logrus.Entry, input *
|
||||
|
||||
var volumeSnapshot *snapshotv1api.VolumeSnapshot
|
||||
cleanUpVolumeSnapshot := false
|
||||
restoreType := input.Restore.Spec.ExistingVolumeDataPolicy
|
||||
if pvcExists {
|
||||
// Pre-flight checks must pass before any side effect on the existing PVC/PV.
|
||||
if err := inplace.CheckPVCBoundToBackedUpVolume(ctx, p.crClient, existingPVC, pvcFromBackup.Spec.VolumeName, pvc.Annotations[velerov1api.InplaceRestoreVolumeHandleAnnotation], pvcFromBackup.Namespace); err != nil {
|
||||
@@ -264,8 +263,7 @@ func (p *pvcRestoreItemAction) executeWithDataMove(logger *logrus.Entry, input *
|
||||
logger.Info("requesting an in-place incremental restore with block data mover, taking a CSI snapshot of the existing PVC as the baseline of CBT...")
|
||||
volumeSnapshot, err = p.createVolumeSnapshot(ctx, logger, input.Restore, *existingPVC, dataUploadResult.SnapshotClass, input.Restore.Spec.CSISnapshotTimeout.Duration)
|
||||
if err != nil {
|
||||
logger.Warnf("fail to create VolumeSnapshot for existing PVC %s/%s: %s, fallback to in-place full restore", existingPVC.Namespace, existingPVC.Name, err.Error())
|
||||
restoreType = velerov1api.VolumeDataPolicyTypeFull
|
||||
logger.Warnf("Fail to create VolumeSnapshot for existing PVC %s/%s: %s, incremental restore will be suppressed", existingPVC.Namespace, existingPVC.Name, err.Error())
|
||||
} else {
|
||||
cleanUpVolumeSnapshot = true
|
||||
defer func() {
|
||||
@@ -304,7 +302,7 @@ func (p *pvcRestoreItemAction) executeWithDataMove(logger *logrus.Entry, input *
|
||||
var dataDownload *velerov2alpha1.DataDownload
|
||||
dataDownload, err = restoreFromDataUploadResult(
|
||||
ctx, dataUploadResult, input.Restore, backup, pvc, existingPV, newNamespace,
|
||||
operationID, string(restoreType), volumeSnapshot, cleanUpVolumeSnapshot, p.crClient)
|
||||
operationID, string(input.Restore.Spec.ExistingVolumeDataPolicy), volumeSnapshot, cleanUpVolumeSnapshot, p.crClient)
|
||||
if err != nil {
|
||||
logger.Errorf("Failed to restore from DataUploadResult: %s", err.Error())
|
||||
return nil, errors.WithStack(err)
|
||||
|
||||
@@ -532,7 +532,7 @@ func TestExecute(t *testing.T) {
|
||||
ObjectMeta(builder.WithOwnerReference([]metav1.OwnerReference{{APIVersion: velerov1api.SchemeGroupVersion.String(), Kind: "Restore", Name: "testRestore", UID: "uid", Controller: boolptr.True()}}),
|
||||
builder.WithLabelsMap(map[string]string{velerov1api.AsyncOperationIDLabel: "dd-uid.", velerov1api.RestoreNameLabel: "testRestore", velerov1api.RestoreUIDLabel: "uid"}),
|
||||
builder.WithGenerateName("testRestore-")).Result()
|
||||
d.Spec.RestoreType = "full"
|
||||
d.Spec.RestoreType = "incremental"
|
||||
d.Spec.DataMover = "velero-block"
|
||||
return d
|
||||
}(),
|
||||
|
||||
Reference in New Issue
Block a user