Skip to content

Commit 07560ee

Browse files
authored
Refactored Quota Docs (#5195)
1 parent 916ed28 commit 07560ee

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

docs/admin/quotas.md

+34-27
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# Quotas
22

3-
Coder Enterprise admins may define quotas to control costs
4-
and ensure equitable access to cloud resources. The quota system controls
5-
instantaneous cost. For example, the system can ensure that every user in your
6-
deployment has a spend rate lower than $10/day at any given moment.
3+
Quotas are a mechanism for controlling spend by associating costs with workspace
4+
templates and assigning budgets to users. Users that exceed their budget will be
5+
blocked from launching more workspaces until they either delete their other workspaces
6+
or get their budget extended.
77

8-
The workspace provisioner enforces quota during workspace start and stop operations.
9-
When users reach their quota, they may unblock themselves by stopping or deleting
10-
their workspace(s).
8+
For example: A template is configured with a cost of 5 credits per day, and the user is
9+
granted a budget of 15 credits per day. This budget limits the user to 3 concurrent workspaces.
1110

1211
Quotas are licensed with [Groups](./groups.md).
1312

1413
## Definitions
1514

16-
- **Credits** is the fundamental unit of the quota system. They map to the
17-
smallest denomination of your preferred currency. For example, if you work with USD,
18-
think of each credit as a cent.
15+
- **Credits** is the fundamental unit representing cost in the quota system. This integer
16+
can be arbitrary, or it can map to your preferred currency.
1917
- **Budget** is the per-user, enforced, upper limit to credit spend.
2018
- **Allowance** is a grant of credits to the budget.
2119

@@ -29,18 +27,13 @@ less quota than an online workspace.
2927
A common use case is separating costs for a persistent volume and ephemeral compute:
3028

3129
```hcl
32-
resource "coder_metadata" "volume" {
33-
resource_id = "${docker_volume.home_volume.id}"
34-
cost = 10
35-
}
36-
3730
resource "docker_volume" "home_volume" {
3831
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
3932
}
4033
41-
resource "coder_metadata" "container" {
42-
resource_id = "${docker_container.workspace.id}"
43-
cost = 20
34+
resource "coder_metadata" "home_volume" {
35+
resource_id = docker_volume.home_volume.id
36+
daily_cost = 10
4437
}
4538
4639
resource "docker_container" "workspace" {
@@ -53,10 +46,22 @@ resource "docker_container" "workspace" {
5346
read_only = false
5447
}
5548
}
49+
50+
resource "coder_metadata" "workspace" {
51+
count = data.coder_workspace.me.start_count
52+
resource_id = docker_container.workspace.id
53+
daily_cost = 20
54+
}
5655
```
5756

58-
In that template, the workspace consumes 10 quota credits when it's offline, and
59-
30 when it's online.
57+
When the workspace above is shut down, the `docker_container` and
58+
`coder_metadata` both get deleted. This reduces the cost from 30 credits to
59+
10 credits.
60+
61+
Resources without a `daily_cost` value are considered to cost 0. If the cost
62+
was removed on the `docker_volume` above, the template would consume 0 credits when
63+
it's offline. This technique is good for incentivizing users to shut down their
64+
unused workspaces and freeing up compute in the cluster.
6065

6166
## Establishing Budgets
6267

@@ -69,18 +74,20 @@ For example:
6974

7075
| Group Name | Quota Allowance |
7176
| ---------- | --------------- |
72-
| Frontend | 100 |
73-
| Backend | 200 |
74-
| Data | 300 |
77+
| Frontend | 10 |
78+
| Backend | 20 |
79+
| Data | 30 |
7580

7681
<br/>
7782

7883
| Username | Groups | Effective Budget |
7984
| -------- | ----------------- | ---------------- |
80-
| jill | Frontend, Backend | 300 |
81-
| jack | Backend, Data | 500 |
82-
| sam | Data | 300 |
83-
| alex | Frontend | 100 |
85+
| jill | Frontend, Backend | 30 |
86+
| jack | Backend, Data | 50 |
87+
| sam | Data | 30 |
88+
| alex | Frontend | 10 |
89+
90+
By default, groups are assumed to have a default allowance of 0.
8491

8592
## Quota Enforcement
8693

0 commit comments

Comments
 (0)