diff --git a/changelogs/unreleased/6397-Nutrymaco b/changelogs/unreleased/6397-Nutrymaco new file mode 100644 index 000000000..318884c73 --- /dev/null +++ b/changelogs/unreleased/6397-Nutrymaco @@ -0,0 +1 @@ +Add missing CompletionTimestamp and metrics when restore moved into terminal phase in restoreOperationsReconciler \ No newline at end of file diff --git a/pkg/controller/restore_operations_controller.go b/pkg/controller/restore_operations_controller.go index 869c5acb1..de7b96a76 100644 --- a/pkg/controller/restore_operations_controller.go +++ b/pkg/controller/restore_operations_controller.go @@ -130,6 +130,8 @@ func (r *restoreOperationsReconciler) Reconcile(ctx context.Context, req ctrl.Re if err != nil { log.Warnf("Cannot check progress on Restore operations because backup info is unavailable %s; marking restore PartiallyFailed", err.Error()) restore.Status.Phase = velerov1api.RestorePhasePartiallyFailed + restore.Status.CompletionTimestamp = &metav1.Time{Time: r.clock.Now()} + r.metrics.RegisterRestorePartialFailure(restore.Spec.ScheduleName) err2 := r.updateRestoreAndOperationsJSON(ctx, original, restore, nil, &itemoperationmap.OperationsForRestore{ErrsSinceUpdate: []string{err.Error()}}, false, false) if err2 != nil { log.WithError(err2).Error("error updating Restore") @@ -140,7 +142,8 @@ func (r *restoreOperationsReconciler) Reconcile(ctx context.Context, req ctrl.Re if info.location.Spec.AccessMode == velerov1api.BackupStorageLocationAccessModeReadOnly { log.Infof("Cannot check progress on Restore operations because backup storage location %s is currently in read-only mode; marking restore PartiallyFailed", info.location.Name) restore.Status.Phase = velerov1api.RestorePhasePartiallyFailed - + restore.Status.CompletionTimestamp = &metav1.Time{Time: r.clock.Now()} + r.metrics.RegisterRestorePartialFailure(restore.Spec.ScheduleName) err := r.updateRestoreAndOperationsJSON(ctx, original, restore, nil, &itemoperationmap.OperationsForRestore{ErrsSinceUpdate: []string{"BSL is read-only"}}, false, false) if err != nil { log.WithError(err).Error("error updating Restore") @@ -189,10 +192,12 @@ func (r *restoreOperationsReconciler) Reconcile(ctx context.Context, req ctrl.Re if restore.Status.Phase == velerov1api.RestorePhaseWaitingForPluginOperations { log.Infof("Marking restore %s completed", restore.Name) restore.Status.Phase = velerov1api.RestorePhaseCompleted + restore.Status.CompletionTimestamp = &metav1.Time{Time: r.clock.Now()} r.metrics.RegisterRestoreSuccess(restore.Spec.ScheduleName) } else { log.Infof("Marking restore %s FinalizingPartiallyFailed", restore.Name) restore.Status.Phase = velerov1api.RestorePhasePartiallyFailed + restore.Status.CompletionTimestamp = &metav1.Time{Time: r.clock.Now()} r.metrics.RegisterRestorePartialFailure(restore.Spec.ScheduleName) } }