Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
We recently turned on prebuilds for a number of our templates in order to speed up new workspace creation times as we run Docker in Docker and the workspace container is very large.
It appears that prebuilds, the TTL feature of prebuilds, workspace autostopping and required workspace stopping do not play nicely together. Essentially, we can get in to a place where prebuild workspaces are stopped instead of deleted, with new prebuild workspaces also running. Behaviour we have observed:
- If the TTL is longer than the workspace default autostop the workspace will be stopped and a new prebuild created. The stopped workspace is not cleaned up.
- When required workspace stopping is enabled, the TTL is ignored and the workspace is stopped and a new prebuild created. Again, the stopped workspace is not cleared up.
In case 1 we ended up with 100s of stopped prebuild workspaces that required us to manually delete them.
Relevant Log Output
Expected Behavior
There are two options here for expected behaviour, and perhaps they should both be implemented with a toggle for which one is being used so that the is better control over the desired outcome.
Option 1
Prebuild workspaces should not be subject to required workspace stopping or dormancy when a TTL is set.
Option 2
Prebuild workspace continue to be subject required workspace stopping or dormancy when a TTL is set but once they are stopped the prebuild system cleans them up as if they were at the end of the TTL.
Steps to Reproduce
The easiest way to reproduce this is to set a TTL for a prebuild that is longer than the default autostop duration for a template. For example, if the TTL for the prebuild is 2 hours and the default autostop is 1 hour.
Environment
- Host OS: K8s envbox
- Coder version: v2.23.1+b906c16
Additional Context
No response