che icon indicating copy to clipboard operation
che copied to clipboard

Prevent users from changing `controller.devfile.io/storage-type` on an existing workspace to avoid confusing & frustrating data loss

Open etsauer opened this issue 1 year ago • 0 comments

Describe the bug

When I go to start a new workspace from scratch, I often follow a workflow like this:

  1. Create a new workspace from a git repo (that has no devfile) OR click the "Empty workspace" sample tile, and then clone a repo
  2. Create a new devfile in the workspace IDE, usually by copying & modifying an existing one that I like
  3. Clicking "Restart workspace from local devfile"

In general this is a great workflow for getting started working on a new project. However occasionally I would get a behavior that was frustrating/unexpected... after that first "Restart workspace from local devfile", my data would get wiped. No repo in /projects, and any other work I had done that I normally expect to persist would be gone.

Eventually I realized that what was happening was that I had inadvertently copy/pasted a devfile that had this config in it:

attributes:
  controller.devfile.io/storage-type: per-workspace

And if I was working in a che-cluster that defaults to "per-user", the result of the restart would be that I would get a brand new PVC on restart, and all my work was missing.

I'm not sure if the right solution here would be to prevent that change, or issue a warning, but I could see this being a huge turn-off to new users trying to get started, and I think we should do something about it

Che version

7.81

Steps to reproduce

  1. Create an empty workspace using the "Empty workspace" sample in a che cluster with default configuration
  2. Clone a repo or add some content to /projects. (e.g. touch /projects/testfile)
  3. Create a new devfile.yaml with the following content:
schemaVersion: 2.2.0
attributes:
  controller.devfile.io/storage-type: per-workspace
metadata:
  name: devspaces-images
components:
- name: dev-tools
  container:
    image: quay.io/redhat-cop/cekit-builder:latest
  1. Click the "Restart workspace form local devfile" option from the IDE
  2. After restart, see that your files are gone (e.g. ls /projects/testfile)

Expected behavior

I would like to be issued a warning of some kind that the devfile is changing the storage type that will result in data loss, or maybe just prevent the change from happening alltogether

Runtime

OpenShift

Screenshots

No response

Installation method

OperatorHub

Environment

Linux

Eclipse Che Logs

No response

Additional context

No response

etsauer avatar Jul 11 '24 15:07 etsauer