Repository navigation
api/quota: One set of limits for every tenant, with 2 profiles - #136
Merged
Merged
Conversation
Every tenant has the same limits (2 instances, 2 vCPU, 4 GiB, 128 GiB of disk, 2 networks) now that the Tenant composition ignores spec.plan. The API reads one set from internal/quota instead of the plan of the tenant, checks a third network as before, and refuses a third profile with a 409 quota_exceeded. The quota answer and GET /v1/limits carry the profiles. MAX_PROFILES_PER_TENANT is no longer read: the limit is the quota's 2. A deployment that still sets it starts as before. The plan of a tenant is kept as it is read and is deprecated: it limits nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Every tenant has the same limits now that the Tenant composition of Hangar ignores
spec.plan(phorge-fr/Hangar#465, merged and live). The API reads one set of limits instead of the plan of the tenant.internal/quota:PerTenantreplaces thePlanstable andLimitsOf.CheckInstanceandCheckNetworklose their plan argument and their messages no longer say "by its plan small" (this tenant has 2 networks out of 2 allowed: delete one first). NewCheckProfile: a third profile is refused with409,quota_exceededandthis tenant has 2 profiles out of 2 allowed (s, m and l do not count): delete one first. The check is made by the API before anything is created, since Incus has no limit for profiles.limitsandusedofGET /v1/tenants/{t}/quota. Only the profiles the users made are counted: the built-ins,mandlare not in the list, are not counted and are not touched.GET /v1/limitskeepsprofile.maxPerTenant, now the quota's 2 for every deployment.TestTheLimitsAreTheOnesOfTheTenantCompositionsays the same numbers as the composition (including the project disk limit of 132096 MiB).limits-and-quotas.md,tenants.md,networks.md,images-and-instances.md,configuration.mdandendpoints.mdfollow. The messages of Incus refusals told inproblemsno longer mention a plan.Decisions
MAX_PROFILES_PER_TENANTis removed. It was a required setting (0meant no limit), so a deployment had to set it. The quota's 2 replaces it: one source for the limit, the same for every tenant, and the setting could only have made the API disagree with it. The API no longer reads or requires it: a deployment that still sets it starts as before, the variable is ignored. Removing it from the deployment is a follow-up for Hangar (harmless until then).planof a tenant is kept as it is read today, and is deprecated: it stays in the body of a tenant, in the create and patch bodies and in the quota answer, until the console stops using it (a later step of the epic). A creation without a plan works. A plan other thansmallon creation, and anyplanonPATCH, were403already and still are, with a sentence that says there is no choice of plan any more. No plan changes any limit: a test shows asmalland alargetenant with the same limits.Not verified here
Run with fake stores only (
go test -race ./...). The integration tests against a cluster were not run, and nothing was written to a cluster.Closes #131