Quotas
Project Quotas allow you to set resource usage and count limits for each project. This works similiarly to kubernetes ResourcesQuotas, but apply to multiple clusters, but Project Quotas can be defined across the whole project or on a per-user basis. Additionally, some additional resource types specific to loft are outlined below.
Please be aware that when you create multiple virtual cluster instances, the individually used resources count toward the shared project quota.
Active Quotas
A virtualclusterinstances.active
or spaceinstances.active
limit will restrict the number of instances of that type that can be active at the same time. These are enforced during instance creation, but also when a request is received to wake up a sleeping instance. This qualifier can be applied to either space instances or virtual cluster instances:
Template Quotas
A virtualclusterinstances
or spaceinstances
limit with .template=template-name
will restrict the number of instances that are using the given template at the same time. These are enforced during instance creation. This qualifier can be applied to either space instances or virtual cluster instances.
Generic Resources
Project Quotas can also specify limits on generic resources such as count/pods
and limits.cpu
in a similar way to a normal kubernetes ResourceQuota
object, but the limits apply to the scope of the Project Quota.
Loft objects such as virtualclusterinstances can be instantly enforced as soon as consumption exeeds the limit, but on-cluster resources such as limits.cpu
cannot be immediately enforced to avoid blocking requests for a long time.
Users may be able to exceed the quota by small amounts by simultaneously creating resources on multiple clusters.
Project Quotas
To configure project quotas follow these steps:
- Navigate to the Projects tab and select the project to configure from the drop down.
- Click on Project Settings.
- Click on Quotas.
- Select the Per Project tab.
- Click on the . An entry in the quota table will appear.
- For the Resource column, select the desired resource. If limiting space instances or virtual cluster instances, you may optionally select spaceinstance.active or virtualclusterinstance.active respectively.
- Optionally for the Template column, select the template on which you'd like to set a limit.
- For the Quota column, enter a number or use the step selector to increase or decrease to the desired count.
- Once all project options have been specified, click the .
User and Team Quotas
Quotas that apply for each user or team can be defined as well. These quotas apply to all users or teams and cannot be applied to specific users and teams. For example, this project defines a total space instance quota of 20, but prevents any user or team from using more than 5 spaces. By adjusting these quotas, you can ensure that no user or team uses more than their fair share of cluster resources.
To configure quotas using the UI, follow these steps:
- Navigate to the Projects tab and select the project to configure from the drop down.
- Click on Project Settings.
- Click on Quotas.
- Select the Per User / Team tab.
- Click on the . An entry in the quota table will appear.
- For the Resource column, select the desired resource. If limiting space instances or virtual cluster instances, you may optionally select spaceinstance.active or virtualclusterinstance.active respectively.
- Optionally for the Template column, select the template on which you'd like to set a limit.
- For the Quota column, enter a number or use the step selector to increase or decrease to the desired count.
- Once all project options have been specified, click the .
If a team is the owner of a space or virtual cluster the usage will be counted by the team and not count against each member of the team, nor will the usage of a team member count towards the team's quota.
Exceeding Quotas
Once the project quotas are defined, users and teams are free to create space instances and virtual cluster instances up to the defined limits. However, once the usage meets the limit, attempts to create a new virtual cluster instance or space instance will be rejected with an error message indicating the resource type and limit that would be exceeded. Here are examples of possible error messages:
Error: metadata.name: Forbidden: cannot create spaceinstance, because project spaceinstances limit of 5 would be exceeded
Error: metadata.name: Forbidden: cannot create spaceinstance, because per-user spaceinstances limit of 5 would be exceeded
Error: metadata.name: Forbidden: cannot create virtualclusterinstance, because project virtualclusterinstances limit of 5 would be exceeded
Error: metadata.name: Forbidden: cannot create virtualclusterinstance, because per-user virtualclusterinstances limit of 5 would be exceeded
In order to avoid these errors in practice, quotas may be increased. Decreasing quotas, on the other hand, will not result in spaces being automatically deleted. In these cases, it is possible and expected that the number of spaces or virtual clusters will exceed limits.