This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.4.2. Resource quotas across multiple projects
A multi-project quota, defined by a ClusterResourceQuota
object, allows quotas to be shared across multiple projects. Resources used in each selected project are aggregated and that aggregate is used to limit resources across all the selected projects.
This guide describes how cluster administrators can set and manage resource quotas across multiple projects.
4.2.1. Selecting multiple projects during quota creation 复制链接链接已复制到粘贴板!
When creating quotas, you can select multiple projects based on annotation selection, label selection, or both.
Procedure
To select projects based on annotations, run the following command:
oc create clusterquota for-user \ --project-annotation-selector openshift.io/requester=<user_name> \ --hard pods=10 \ --hard secrets=20
$ oc create clusterquota for-user \ --project-annotation-selector openshift.io/requester=<user_name> \ --hard pods=10 \ --hard secrets=20
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This creates the following
ClusterResourceQuota
object:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
ResourceQuotaSpec
object that will be enforced over the selected projects. - 2
- A simple key-value selector for annotations.
- 3
- A label selector that can be used to select projects.
- 4
- A per-namespace map that describes current quota usage in each selected project.
- 5
- The aggregate usage across all selected projects.
This multi-project quota document controls all projects requested by
<user_name>
using the default project request endpoint. You are limited to 10 pods and 20 secrets.Similarly, to select projects based on labels, run this command:
oc create clusterresourcequota for-name \ --project-label-selector=name=frontend \ --hard=pods=10 --hard=secrets=20
$ oc create clusterresourcequota for-name \
1 --project-label-selector=name=frontend \
2 --hard=pods=10 --hard=secrets=20
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This creates the following
ClusterResourceQuota
object definition:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.2.2. Viewing applicable cluster resource quotas 复制链接链接已复制到粘贴板!
A project administrator is not allowed to create or modify the multi-project quota that limits his or her project, but the administrator is allowed to view the multi-project quota documents that are applied to his or her project. The project administrator can do this via the AppliedClusterResourceQuota
resource.
Procedure
To view quotas applied to a project, run:
oc describe AppliedClusterResourceQuota
$ oc describe AppliedClusterResourceQuota
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.2.3. Selection granularity 复制链接链接已复制到粘贴板!
Because of the locking consideration when claiming quota allocations, the number of active projects selected by a multi-project quota is an important consideration. Selecting more than 100 projects under a single multi-project quota can have detrimental effects on API server responsiveness in those projects.