-
Notifications
You must be signed in to change notification settings - Fork 925
Implement Quotas v3 #5012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Quotas v3 #5012
Conversation
@sharkymark @whitney-coder @ericpaulsen — once this is merged, Quotas will come with Template RBAC and the Quota field in licenses will have no effect. |
@@ -0,0 +1,3 @@ | |||
ALTER TABLE workspace_builds ADD COLUMN cost int NOT NULL DEFAULT 0; | |||
ALTER TABLE workspace_resources ADD COLUMN cost int NOT NULL DEFAULT 0; | |||
ALTER TABLE groups ADD COLUMN quota_allowance int NOT NULL DEFAULT 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might make this daily_quota_allowance
as well... although since it's not time based, that gets a bit odd... maybe maximum_concurrent_quota
?
The quota is enabled by either the `CODER_USER_WORKSPACE_QUOTA` | ||
environment variable or the `--user-workspace-quota` flag. For example, | ||
you may limit each user in a deployment to 5 workspaces like so: | ||
The workspace provisioner enforces quota during workspace start and stop operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workspace provisioner enforces quota during workspace start and stop operations. | |
The workspace provisioner enforces quotas during workspace start and stop operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops
|
||
## Enabling this feature | ||
Coder enforces Quota on workspace start and stop operations. The workspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coder enforces Quota on workspace start and stop operations. The workspace | |
Coder enforces quotas on workspace start and stop operations. The workspace |
@@ -132,7 +132,7 @@ message Resource { | |||
bool hide = 5; | |||
string icon = 6; | |||
string instance_type = 7; | |||
int32 cost = 8; | |||
int32 daily_cost = 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure there was a conversation here, but why we did land on "daily" as the unit? I've been thinking about how we present this, and the more I thought about it the more I think giving this a unit is not ideal. Mainly because of it being lossy to our currently planned implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to encourage standard practices across all deployments for follow-on features such as reporting and burst quotas. For time units, the reasonable options are "hourly", "daily" and "monthly".
I threw out hourly because I thought it may require precision beyond a cent. For example, a $20/m instance costs 2.7 cents per hour, and we want to avoid floating point arithmetic.
I threw out monthly because it's not always clear what the exact length of a month is. It could be 30, 30.5, or 30.437 (right answer) days.
@@ -8,8 +8,8 @@ import ( | |||
) | |||
|
|||
type WorkspaceQuota struct { | |||
UserWorkspaceCount int `json:"user_workspace_count"` | |||
UserWorkspaceLimit int `json:"user_workspace_limit"` | |||
CreditsConsumed int `json:"credits_consumed"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We aren't really using the "credits" terminology anywhere else, right? Seems a little odd to introduce at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree, it could just be "QuotaConsumed"?
Some background here.
terraform-provider-coder
and publish a new release therecost
— use hourly/daily/monthly and smallest denomination of currency (e.g. cents for USD)coder/license
tooLater
Follow-up tasks to be worked after merge: