Skip to content

Workspaces with container components from contributions are not backed up #1580

@rohanKanojia

Description

@rohanKanojia

Description

The backup functionality fails to back up workspaces that define their container components through contributions rather than directly in the spec.template.components section. The backup controller incorrectly determines that these workspaces don't need storage because it checks storage requirements on the unflattened DevWorkspace definition, which doesn't include components from contributions.

How To Reproduce

  • Configure backup in DevWorkspaceOperatorConfig
  • Create two DevWorkspaces with projects and the che-code contribution:
  • Start both workspaces, let them run, then stop them
  • Wait for the backup cron job to run
  • Check the backup job created:
    • Workspace 1 (git-clone-sample-devworkspace): No backup created
    • Workspace 2 (code-latest): Backup job created successfully and backup image pushed successfully

Expected behavior

Both workspaces should be backed up. The backup controller should recognize that both workspaces have persistent storage (PVCs) containing project data that needs to be backed up, regardless of whether container components are defined directly in the template or imported via contributions.

After flattening/resolving contributions, both workspaces have identical final configurations with containers that mount sources, so they should both be treated as needing backup.

Additional context

Backup job Pod logs:

oc logs pod/devworkspace-backup-t226z-brvhf                                                                                                                           ─╯
+ set -e
+ exec /workspace-recovery.sh --backup

Backing up devworkspace 'code-latest' in namespace 'openshift-operators' to image 'quay.io/rokumar/openshift-operators/code-latest:latest'
./
./web-nodejs-sample/
./web-nodejs-sample/.git/
./web-nodejs-sample/.git/branches/
./web-nodejs-sample/.git/description
./web-nodejs-sample/.git/hooks/
./web-nodejs-sample/.git/hooks/applypatch-msg.sample
./web-nodejs-sample/.git/hooks/commit-msg.sample
./web-nodejs-sample/.git/hooks/fsmonitor-watchman.sample
./web-nodejs-sample/.git/hooks/post-update.sample
./web-nodejs-sample/.git/hooks/pre-applypatch.sample
./web-nodejs-sample/.git/hooks/pre-commit.sample
./web-nodejs-sample/.git/hooks/pre-merge-commit.sample
./web-nodejs-sample/.git/hooks/pre-push.sample
./web-nodejs-sample/.git/hooks/pre-rebase.sample
./web-nodejs-sample/.git/hooks/pre-receive.sample
./web-nodejs-sample/.git/hooks/prepare-commit-msg.sample
./web-nodejs-sample/.git/hooks/push-to-checkout.sample
./web-nodejs-sample/.git/hooks/sendemail-validate.sample
./web-nodejs-sample/.git/hooks/update.sample
./web-nodejs-sample/.git/info/
./web-nodejs-sample/.git/info/exclude
./web-nodejs-sample/.git/config
./web-nodejs-sample/.git/objects/
./web-nodejs-sample/.git/objects/pack/
./web-nodejs-sample/.git/objects/pack/pack-00c9cb529f78a543deaf778dfaffcb012aef3c11.pack
./web-nodejs-sample/.git/objects/pack/pack-00c9cb529f78a543deaf778dfaffcb012aef3c11.rev
./web-nodejs-sample/.git/objects/pack/pack-00c9cb529f78a543deaf778dfaffcb012aef3c11.idx
./web-nodejs-sample/.git/objects/info/
./web-nodejs-sample/.git/HEAD
./web-nodejs-sample/.git/refs/
./web-nodejs-sample/.git/refs/heads/
./web-nodejs-sample/.git/refs/heads/main
./web-nodejs-sample/.git/refs/tags/
./web-nodejs-sample/.git/refs/remotes/
./web-nodejs-sample/.git/refs/remotes/origin/
./web-nodejs-sample/.git/refs/remotes/origin/HEAD
./web-nodejs-sample/.git/packed-refs
./web-nodejs-sample/.git/logs/
./web-nodejs-sample/.git/logs/refs/
./web-nodejs-sample/.git/logs/refs/remotes/
./web-nodejs-sample/.git/logs/refs/remotes/origin/
./web-nodejs-sample/.git/logs/refs/remotes/origin/HEAD
./web-nodejs-sample/.git/logs/refs/heads/
./web-nodejs-sample/.git/logs/refs/heads/main
./web-nodejs-sample/.git/logs/HEAD
./web-nodejs-sample/.git/index
./web-nodejs-sample/.git/FETCH_HEAD
./web-nodejs-sample/.gitattributes
./web-nodejs-sample/.github/
./web-nodejs-sample/.github/CODEOWNERS
./web-nodejs-sample/.gitignore
./web-nodejs-sample/.vscode/
./web-nodejs-sample/.vscode/launch.json
./web-nodejs-sample/LICENSE
./web-nodejs-sample/README.md
./web-nodejs-sample/app/
./web-nodejs-sample/app/app.js
./web-nodejs-sample/devfile.yaml
./web-nodejs-sample/package-lock.json
./web-nodejs-sample/package.json
./.code-workspace
Uploading 07c337d501c9 devworkspace-backup.tar.gz
Uploaded  07c337d501c9 devworkspace-backup.tar.gz
Pushed [registry] quay.io/rokumar/openshift-operators/code-latest:latest
ArtifactType: application/vnd.devworkspace.backup.artifact.v1+json
Digest: sha256:40608e74c1c51e7aad754d26b3209d5e0bc5e341f4f42456ae8922e5ca23a3f9
Backup completed successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions