Applying Quotas to Multiple Projects

The ClusterResourceQuota resource is created at cluster level, in a similar way to a persistent volume, and specifies resource constraints that apply to multiple projects.

Cluster administrators can specify which projects are subject to cluster resource quotas in two ways:

  • Using the openshift.io/requester annotation to specify the project owner. All projects with the specified owner are subject to the quota.
  • Using a selector. All projects whose labels match the selector are subject to the quota.

The following is an example of creating a cluster resource quota for all projects owned by the qa user:

oc create clusterquota user-qa \
> --project-annotation-selector openshift.io/requester=qa \
> --hard pods=12,secrets=20

The following is an example of creating a cluster resource quota for all projects that have been assigned the environment=qa label:

oc create clusterquota env-qa \
> --project-label-selector environment=qa \
> --hard pods=10,services=5

Project users can use the oc describe QUOTA command to view cluster resource quotas that apply to the current project, if any.

Use the oc delete command to delete a cluster resource quota:

oc delete clusterquota QUOTA
Daftar Materi