Skip to content

Backup/Restore status is missing startedAt and reports a fabricated completedAt #71

Description

@recharte

Summary

SyncBackup and SyncRestore never populate BackupExecutionStatus.StartedAt / RestoreExecutionStatus.StartedAt, and they set CompletedAt to metav1.Now() instead of the operator's real completion timestamp. As a result, PSMDB Backup / Restore CRs show an empty status.startedAt and a status.completedAt that does not reflect when the operation actually finished.

Details

For ProviderManaged execution mode, the runtime populates these fields only from what the provider returns — there is no fallback:

https://github.com/openeverest/openeverest/blob/2f7662c55ebf/provider-runtime/reconciler/backup.go#L229-L234

if exec.StartedAt != nil && backup.Status.StartedAt == nil {
    backup.Status.StartedAt = exec.StartedAt
}
if exec.CompletedAt != nil {
    backup.Status.CompletedAt = exec.CompletedAt
}

(The in-tree Job-mode controller stamps StartedAt itself when it creates the Job, which is why this only affects provider-managed classes.)

In this provider:

Two consequences:

  1. startedAt is always empty. The UI backups table sorts/renders a "Started" column from status.startedAt, and the restore-selection dropdown falls back to the backup name when startedAt is absent.
  2. completedAt drifts. Because the runtime overwrites status.completedAt on every reconcile where exec.CompletedAt != nil, a long-finished backup gets its completion time rewritten to "now" each time the Backup is re-reconciled.

Expected

Map the timestamps the PSMDB operator already exposes on PerconaServerMongoDBBackupStatus and PerconaServerMongoDBRestoreStatus:

OpenEverest field Source
Backup.status.startedAt PerconaServerMongoDBBackup.status.start (Status.StartAt)
Backup.status.completedAt PerconaServerMongoDBBackup.status.completed (Status.CompletedAt)
Restore.status.startedAt PerconaServerMongoDBRestore.metadata.creationTimestamp (the restore CR has no start field)
Restore.status.completedAt PerconaServerMongoDBRestore.status.completed (Status.CompletedAt)

Reference implementation

provider-percona-xtradb-cluster already does exactly this and can be copied:

if !opBackup.CreationTimestamp.IsZero() {
    t := opBackup.CreationTimestamp
    exec.StartedAt = &t
}
...
case pxcv1.BackupSucceeded:
    exec.State = backupv1alpha1.BackupStateSucceeded
    exec.CompletedAt = opBackup.Status.CompletedAt

Notes

  • The operator object's status is already available after controllerutil.CreateOrUpdate (it performs a Get first), so no extra read is needed.
  • Guard against zero-valued timestamps (!t.IsZero() / nil checks) before assigning, as PXC does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions