|
| 1 | +[[admin-guide-muliproject-quota]] |
| 2 | += Multi-Project Quotas |
| 3 | +{product-author} |
| 4 | +{product-version} |
| 5 | +:data-uri: |
| 6 | +:icons: |
| 7 | +:experimental: |
| 8 | +:toc: macro |
| 9 | +:toc-title: |
| 10 | +:prewrap!: |
| 11 | + |
| 12 | +toc::[] |
| 13 | + |
| 14 | +== Overview |
| 15 | + |
| 16 | +A multi-project quota, defined by a `*ClusterResourceQuota*` object, allows xref:../admin_guide/quota.adoc#admin-guide-quota[quota] |
| 17 | +to be shared across multiple projects. Resources used in each selected project |
| 18 | +will be aggregated and that aggregate will be used to limit resources across |
| 19 | +all the selected projects. |
| 20 | + |
| 21 | +[[multi-project-quotas-selecting-projects]] |
| 22 | +=== Selecting Projects |
| 23 | + |
| 24 | +Projects can be selected based on either annotation selection, label selection, or both. |
| 25 | +For example, `oc create clusterquota for-user --project-annotation-selector openshift.io/requester=<user-name> --hard pods=10 --hard secrets=20` |
| 26 | +creates: |
| 27 | + |
| 28 | +==== |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | +apiVersion: v1 |
| 32 | +kind: ClusterResourceQuota |
| 33 | +metadata: |
| 34 | + name: for-user |
| 35 | +spec: |
| 36 | + quota: <1> |
| 37 | + hard: |
| 38 | + pods: "10" |
| 39 | + secrets: "20" |
| 40 | + selector: |
| 41 | + annotations: <2> |
| 42 | + openshift.io/requester: <user-name> |
| 43 | + labels: null <3> |
| 44 | +status: |
| 45 | + namespaces: <4> |
| 46 | + - namespace: ns-one |
| 47 | + status: |
| 48 | + hard: |
| 49 | + pods: "10" |
| 50 | + secrets: "20" |
| 51 | + used: |
| 52 | + pods: "1" |
| 53 | + secrets: "9" |
| 54 | + total: <5> |
| 55 | + hard: |
| 56 | + pods: "10" |
| 57 | + secrets: "20" |
| 58 | + used: |
| 59 | + pods: "1" |
| 60 | + secrets: "9" |
| 61 | +---- |
| 62 | +<1> The ResourceQuotaSpec object that will be enforced over the selected projects |
| 63 | +<2> A simple key/value selector for annotations |
| 64 | +<3> A label selector that can be used to select projects |
| 65 | +<4> A per-namespace map that describes current quota usage in each selected project |
| 66 | +<5> The aggregate usage across all selected projects |
| 67 | +==== |
| 68 | + |
| 69 | +This multi-project quota document will control all projects requested by `"<user-name>"` using the default |
| 70 | +project request endpoint. He will be limited to ten pods and twenty secrets. |
| 71 | + |
| 72 | + |
| 73 | +[[multi-project-quotas-viewing-applicable-clusterresourcequotas]] |
| 74 | +=== Viewing Applicable ClusterResourceQuotas |
| 75 | + |
| 76 | +A project-admin is not allowed to create or modify the multi-project quota that limits |
| 77 | +him, but he is allowed to view the multi-project quota documents are applied to his project. |
| 78 | +He can do this via the `*AppliedClusterResourceQuota*` resource. |
| 79 | + |
| 80 | +`oc describe AppliedClusterResourceQuota` produces: |
| 81 | + |
| 82 | +==== |
| 83 | +---- |
| 84 | +Name: for-user |
| 85 | +Namespace: <none> |
| 86 | +Created: 19 hours ago |
| 87 | +Labels: <none> |
| 88 | +Annotations: <none> |
| 89 | +Label Selector: <null> |
| 90 | +AnnotationSelector: map[openshift.io/requester:<user-name>] |
| 91 | +Resource Used Hard |
| 92 | +-------- ---- ---- |
| 93 | +pods 1 10 |
| 94 | +secrets 9 20 |
| 95 | +---- |
| 96 | +==== |
| 97 | + |
| 98 | + |
| 99 | +[[multi-project-quotas-selection-granularity]] |
| 100 | +=== Selection Granularity |
| 101 | + |
| 102 | +Because of the locking consideration when claiming quota allocations, the |
| 103 | +number of active projects selected by a multi-project quota is an important consideration. |
| 104 | +Selecting more than 100 projects under a single multi-project quota may have |
| 105 | +deleterious effects on API server responsiveness in those projects. |
0 commit comments