Skip to content

Enforce workspaces_quota and workspaces_per_user_quota

What does this MR do and why?

Enforce workspaces_quota and workspaces_per_user_quota value of the agent while creating the workspace

  • User cannot create a workspace if they already have workspaces_per_user_quota existing workspaces for the given agent. An error is received in response of the workspace creation.
  • No workspaces can be created using the agent if they already have workspaces_quota existing workspaces for the given agent.
  • The query to count workspaces will use the actual_state instead of desired_state columns of the database. Furthermore, every workspace that is not currently Terminated will count towards the above quotas.
  • We will allow quota reductions if even 1 user is exceeds the new intended values. So, it will be possible to reduce the per user quota from 10 -> 5 even if a user has more than 5 workspaces at the time of the update.
  • Assuming a user exists with more workspaces than allowed by the configured quotas, what should be done if the user chooses to start a stopped workspace or restart a running workspace. The conclusion for this case is to allow the user these actions as that will keep the domain logic simple. In short, these quotas are applicable when creating workspaces only and not when updating already created workspaces.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Edit agent config Exceeds per user quota Exceeds overall quota
image image image

How to set up and validate locally

  1. Setup local RD development per https://gitlab.com/gitlab-org/remote-development/gitlab-remote-development-docs/-/blob/main/doc/local-development-environment-setup.md#setup-gdk-ga4k-and-remote-development-configuration
  2. Edit your quota http://gdk.test:3000/gitlab-org/gitlab-agent-configurations/-/blob/main/.gitlab/agents/remotedev/config.yaml

  workspaces_quota: 1
  workspaces_per_user_quota: 3
  1. Try to create 2 workspaces for the agent.
Edited by Alper Akgun

Merge request reports