Skip to content

feat: Add per-workspace backup status tracking with annotations - #1550

Merged
dkwon17 merged 8 commits into
mainfrom
1549
Jan 9, 2026
Merged

dkwon17 merged 8 commits into
mainfrom
1549

Conversation

@tolusha

@tolusha tolusha commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Enhance the backup cronjob controller to track backup status individually for each workspace using annotations. This allows more granular control over when backups are triggered based on each workspace's specific backup history rather than a global timestamp.

  • Add handleBackupJobStatus to update DevWorkspace annotations when backup jobs complete or fail
  • Modify wasStoppedSinceLastBackup to check workspace-specific annotations first, falling back to global time
  • Include DevWorkspace name label on backup jobs for easier association

Assisted-by: Claude

What issues does this PR fix or reference?

#1549

Is it tested? How?

Follow the #1530

kind: DevWorkspace
metadata:
  annotations:
    controller.devfile.io/last-backup-successful: 'true'
    controller.devfile.io/last-backup-time: '2025-12-23T10:20:05.030687Z'

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

@openshift-ci

openshift-ci Bot commented Dec 19, 2025

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
@rohanKanojia

Copy link
Copy Markdown
Member

I tested it and it seems to work as expected.

On successful backup devworkspace is updated with annotations:

- apiVersion: workspace.devfile.io/v1alpha2
  kind: DevWorkspace
  metadata:
    annotations:
      controller.devfile.io/last-backup-successful: "true"
      controller.devfile.io/last-backup-time: "2026-01-05T11:02:40.149872Z"

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
@openshift-ci openshift-ci Bot removed the lgtm label Jan 5, 2026
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
// Get the last backup time and success status from the workspace annotations
if devWorkspace.Annotations != nil {
if lastBackupFinishedAtStr, ok := devWorkspace.Annotations[constants.DevWorkspaceLastBackupFinishedAtAnnotation]; ok {
parsedTime, err := time.Parse(time.RFC3339Nano, lastBackupFinishedAtStr)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the RFC3339Micro should be used (according to https://github.com/devfile/devworkspace-operator/pull/1550/changes#diff-5509053b46d7570ac99788ae88a71179c263829eb7b4d3d91ecfc87775e58467R188-R190)

Suggested change
parsedTime, err := time.Parse(time.RFC3339Nano, lastBackupFinishedAtStr)
parsedTime, err := time.Parse(time.RFC3339Micro, lastBackupFinishedAtStr)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Adding to @akurinnoy 's comment, is there a reason why we are using time.RFC3339Micro when setting the time here [1], but use time.RFC3339Nano when parsing the lastBackupFinishedAtStr ?

[1]

devWorkspace.Annotations[constants.DevWorkspaceLastBackupFinishedAtAnnotation] = condition.LastTransitionTime.Format(metav1.RFC3339Micro)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, the reason is claude

@dkwon17 dkwon17 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM functionality-wise, just 1 comment

@openshift-ci

openshift-ci Bot commented Jan 8, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dkwon17, rohanKanojia, tolusha

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved label Jan 8, 2026
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
@openshift-ci openshift-ci Bot removed the lgtm label Jan 9, 2026
@openshift-ci

openshift-ci Bot commented Jan 9, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@tolusha

tolusha commented Jan 9, 2026

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@tolusha

tolusha commented Jan 9, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jan 9, 2026

Copy link
Copy Markdown

@tolusha: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v14-che-happy-path 80a9d5c link true /test v14-che-happy-path

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@dkwon17

dkwon17 commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

The e2e test failure looks like the same error we see in this PR #1554

@dkwon17
dkwon17 merged commit 0bcd7a6 into main Jan 9, 2026
9 of 10 checks passed
@dkwon17
dkwon17 deleted the 1549 branch January 9, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants