You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to move my primary workspace off the coder template to the coder-ts template that Ammar created. The only problem is I obviously can't use my primary workspace name dev for both workspaces.
Definition of done
It would be nice if I could rename my obsolete workspace and claim dev for my new workspace.
Well, just something stable with the lifecycle of the workspace, so random would be good.
If we allow workspace renames I think all existing templates would still work, it's just that your persistent volume would be named inconsistently from the workspace, leading to confusion and conflict risk.
And I suppose we should require that the workspace is offline for a rename to occur to avoid a situation where infrastructure names are misaligned with Coder names.
And I suppose we should require that the workspace is offline for a rename to occur to avoid a situation where infrastructure
names are misaligned with Coder names.
Should that matter? Shouldn't we be referencing resources with a parameter that's static for the lifecycle of the resource?
Do y'all mean that the infrastructure names are static for the lifetime of the workspace? So if I rename my workspace the infrastructure name doesn't change? Beyond the potential to be confusing, this would create a conflict bug when a new workspace is created with the old name on the same template.
Do y'all mean that the infrastructure names are static for the lifetime of the workspace? So if I rename my workspace the
infrastructure name doesn't change?
I know that for example in v1 we used the human-friendly name of the pod + some suffix that k8s generates to ensure uniqueness, but to search for it we always queried for the label with the ID of the workspace. So if you updated the name of your workspace, it didn't affect our ability to track the underlying compute.
Looking at v1 funny enough we don't actually allow you to update names but I'm pretty sure things are designed that enabling that should work.
Would it be unfeasible for a rename to simply be a surface-level change that does not release the underlying name the workspace was created with?
For instance, say you have a workspace named work, you rename it other. Now both work and other are occupied, and you can only reach your workspace via other.
If you try to create a new work workspace, an error would tell you the name is occupied by other.
This would avoid issues like needing the workspace to be offline, or renaming resources at a cloud provider (which might not be possible).
If this is a no-go, then I believe we should try to address #3048 before allowing renames.
I think that could be confusing to users. What if I rename a renamed workspace? Does the old name free up?
I think we can address #3048 first if you feel it'd lead to a better experience, but I don't think it's entirely mandatory. I'm of the perspective a workspace doesn't even need to be stopped to rename.
@kylecarbs I started working on this today and observed the issue I had in mind when proposing immutable underlying names, with changeable "pretty names". (This is mostly due to the limitation of how workspaces are created today).
Case 1 (because templates uses data.coder_workspace.me.name as part of the volume name):
A user renames their workspace
The users workspace stops
Terraform deletes the home volume because data.coder_workspace.me.name changed
The users workspace starts and has no data
This is what happens with the docker provider, at least.
In this scenario, if the users workspace was stopped during rename, the delete would happen on start, but in either case, data is lost.
Case 2 (we try to work-around case 1 by using immutable volume names):
A user renames their workspace (say, from current to old)
The current workspace name is freed up (but the volume name still exists)
The user tries to create a workspace named current but there is a naming collision with the volume
Or in the worst case scenario, inherits the volume used by old
These issues could be worked around if providers allowed us to rename resources, but we can't expect that to be the case for all of them (and that would require user configuration).
We can work around all these issues by using data.coder_workspace.me.id instead of data.coder_workspace.me.name, however, current users are at risk of data loss.
To ensure no data is lost, either 3i) has to happen or we permanently reserve the name for any non-deleted workspaces.
I think we shouldn't promote names being used, and instead user IDs should be. This property is already exposed to the Terraform too.
This will probably bite some people, and we can work to improve our updates separately by showing a preview of a dry run. I don't think we should try to do anything magical with the variables though, because there will always be edge-cases we can't fix.
I'm all for changing (and promoting) IDs in the templates, I think that's great. What I worry about is that this will bite every one of our current users. A breaking change would be fine but data loss is more severe IMO.
Addendum: Every one using the rename feature at least. But I imagine this will likely happen after template updates as well where the user is keeping their templates in sync with our sample ones.
This has been merged with the caveat that renaming will almost definitely result in data loss. For this reason, coder rename is a hidden command and has an annoying confirmation prompt.
For renaming to be useful, step 1 is for #3663 to be merged (and users ensuring their volume names are immutable).
But ultimately, we'd want #3386 fixed so that renaming is safe.
Activity
sharkymark commentedon Jul 15, 2022
I want this. There should be a pencil icon next to the workspace name to change this.
ammario commentedon Jul 18, 2022
Related #2877
ammario commentedon Jul 18, 2022
As apart of this, we should suggest that persistent resources are named using an ID.
ketang commentedon Jul 18, 2022
Completely arbitrary/random, deterministic, or some combination?
ammario commentedon Jul 18, 2022
Well, just something stable with the lifecycle of the workspace, so random would be good.
If we allow workspace renames I think all existing templates would still work, it's just that your persistent volume would be named inconsistently from the workspace, leading to confusion and conflict risk.
kylecarbs commentedon Jul 18, 2022
All resources in the database have a UUIDv4 associated right now. This isn't editable right now just because we haven't done it.
ammario commentedon Jul 18, 2022
And I suppose we should require that the workspace is offline for a rename to occur to avoid a situation where infrastructure names are misaligned with Coder names.
kylecarbs commentedon Jul 18, 2022
Now that's a fun problem. The same exists with a username.
sreya commentedon Jul 18, 2022
Should that matter? Shouldn't we be referencing resources with a parameter that's static for the lifecycle of the resource?
kylecarbs commentedon Jul 18, 2022
Agreed @sreya. We shouldn't require a workspace is offline for that reason.
ammario commentedon Jul 18, 2022
Do y'all mean that the infrastructure names are static for the lifetime of the workspace? So if I rename my workspace the infrastructure name doesn't change? Beyond the potential to be confusing, this would create a conflict bug when a new workspace is created with the old name on the same template.
ketang commentedon Jul 18, 2022
I think semi-deterministic has value for auditing and cleanup. Completely arbitrary/random IDs are more opaque.
Hmmm... and what about rebuilds 🤔 ?
ammario commentedon Jul 18, 2022
What are the inputs to a deterministic ID?
sreya commentedon Jul 18, 2022
I know that for example in v1 we used the human-friendly name of the pod + some suffix that k8s generates to ensure uniqueness, but to search for it we always queried for the label with the ID of the workspace. So if you updated the name of your workspace, it didn't affect our ability to track the underlying compute.
Looking at v1 funny enough we don't actually allow you to update names but I'm pretty sure things are designed that enabling that should work.
10 remaining items
tjcran commentedon Jul 21, 2022
Duplicates #2188
mafredri commentedon Jul 26, 2022
Would it be unfeasible for a rename to simply be a surface-level change that does not release the underlying name the workspace was created with?
For instance, say you have a workspace named
work, you rename itother. Now bothworkandotherare occupied, and you can only reach your workspace viaother.If you try to create a new
workworkspace, an error would tell you the name is occupied byother.This would avoid issues like needing the workspace to be offline, or renaming resources at a cloud provider (which might not be possible).
If this is a no-go, then I believe we should try to address #3048 before allowing renames.
kylecarbs commentedon Jul 26, 2022
I think that could be confusing to users. What if I rename a renamed workspace? Does the old name free up?
I think we can address #3048 first if you feel it'd lead to a better experience, but I don't think it's entirely mandatory. I'm of the perspective a workspace doesn't even need to be stopped to rename.
mafredri commentedon Aug 3, 2022
@kylecarbs I started working on this today and observed the issue I had in mind when proposing immutable underlying names, with changeable "pretty names". (This is mostly due to the limitation of how workspaces are created today).
Case 1 (because templates uses
data.coder_workspace.me.nameas part of the volume name):data.coder_workspace.me.namechangedThis is what happens with the docker provider, at least.
In this scenario, if the users workspace was stopped during rename, the delete would happen on start, but in either case, data is lost.
Case 2 (we try to work-around case 1 by using immutable volume names):
currenttoold)currentworkspace name is freed up (but the volume name still exists)currentbut there is a naming collision with the volumeoldThese issues could be worked around if providers allowed us to rename resources, but we can't expect that to be the case for all of them (and that would require user configuration).
We can work around all these issues by using
data.coder_workspace.me.idinstead ofdata.coder_workspace.me.name, however, current users are at risk of data loss.To ensure no data is lost, either 3i) has to happen or we permanently reserve the name for any non-deleted workspaces.
kylecarbs commentedon Aug 3, 2022
I think we shouldn't promote names being used, and instead user IDs should be. This property is already exposed to the Terraform too.
This will probably bite some people, and we can work to improve our updates separately by showing a preview of a dry run. I don't think we should try to do anything magical with the variables though, because there will always be edge-cases we can't fix.
mafredri commentedon Aug 3, 2022
I'm all for changing (and promoting) IDs in the templates, I think that's great. What I worry about is that this will bite every one of our current users. A breaking change would be fine but data loss is more severe IMO.
Addendum: Every one using the rename feature at least. But I imagine this will likely happen after template updates as well where the user is keeping their templates in sync with our sample ones.
kylecarbs commentedon Aug 3, 2022
We could implement a check if the workspace was created before a specific time, and warn the user.
ammario commentedon Aug 3, 2022
👍🏽
Right now is the time to break things.
mafredri commentedon Aug 5, 2022
Since the problem I raised here is a bit more involved (not just limited to renames), I've opened a separate issue to track it: #3386.
fix: Use immutable names for volumes in example templates
mafredri commentedon Aug 26, 2022
This has been merged with the caveat that renaming will almost definitely result in data loss. For this reason,
coder renameis a hidden command and has an annoying confirmation prompt.For renaming to be useful, step 1 is for #3663 to be merged (and users ensuring their volume names are immutable).
But ultimately, we'd want #3386 fixed so that renaming is safe.
fix: Use immutable names for volumes in example templates
fix: Use immutable names for volumes in example templates (#4954)