che
che copied to clipboard
Prevent users from changing `controller.devfile.io/storage-type` on an existing workspace to avoid confusing & frustrating data loss
Describe the bug
When I go to start a new workspace from scratch, I often follow a workflow like this:
- Create a new workspace from a git repo (that has no devfile) OR click the "Empty workspace" sample tile, and then clone a repo
- Create a new devfile in the workspace IDE, usually by copying & modifying an existing one that I like
- 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
- Create an empty workspace using the "Empty workspace" sample in a che cluster with default configuration
- Clone a repo or add some content to
/projects. (e.g.touch /projects/testfile) - Create a new
devfile.yamlwith 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
- Click the "Restart workspace form local devfile" option from the IDE
- 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