Set a limit for concurrent workspaces
MR: Pending
Description
As a gitlab instance administrator, I want to place a limit on the number of concurrent workspaces that can be created, so that the potential infrastructure cost can have a bounded upper limit.
Problem to solve
The initial Beta for remote development workspaces places no limits on the number of workspaces that can be created in any context. Allowing teams of developers to arbitrarily use cloud compute could incur significant costs over time.
Proposal
As an initial safeguard, add an optional configuration to the agent that limits the number of concurrent non-terminated workspaces that can be created.
- Default value should be
unlimited
- If a developer tries to create a workspace when the agent has reached its limit, display an appropriate error message
- If the agent has hit its limit, it should still show up in the selector
There will be edge cases where we may have workspaces created at exactly the same time, which is okay. Take this scenario:
- Someone sets a limit of 50 but when there are currently 49 non-terminated workspaces
- 3 developers simultaneously create a workspace
- We end up with 52 workspaces, which is okay. We won't be able to create a workspace on that agent until it falls below 50.
Details
Error message:
"This agent has reached its limit for concurrent workspaces. Please try creating your workspace again later or select a different agent."
Later iterations
As a first iteration, we're looking for the MVC that provides safety for larger teams. This is the best first step because it doesn't involve any significant UI changes or new database tables. We'll look to expand this in later iterations by:
- Validating the availability of the agent to create a workspace before creating the workspace
- Implement some kind of queue so you don't have to try again
- Setting a limit to the number of workspaces per user
- We'll provide UI for settings that are agent or instance-specific
Acceptance Criteria
TODO: Fill out (required)
-
The appropriate error message as described above should be presented when attempting to create a workspace when the agent has already reached the limit.
Design Requirements
There should be no UI changes required. As long as we return the error message in the standard graphql error structure like we already do for other workspace creation errors, it will be presented properly in the existing UI.
Impact Assessment
Allows users to control infrastructure costs.