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.第18章 複数プロジェクトのクォータ設定
18.1. 概要
ClusterResourceQuota
オブジェクトで定義される複数プロジェクトのクォータは、クォータを複数プロジェクト間で共有できるようにします。それぞれの選択されたプロジェクトで使用されるリソースは集計され、その集計は選択したすべてのプロジェクトでリソースを制限するために使用されます。
18.2. プロジェクトの選択
プロジェクトは、アノテーションの選択またはラベルの選択のいずれか、またはその両方に基づいて選択できます。たとえば、アノテーションに基づいてプロジェクトを選択するには、以下のコマンドを実行します。
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
これは以下の ClusterResourceQuota
オブジェクトを作成します。
apiVersion: v1 kind: ClusterResourceQuota metadata: name: for-user spec: quota: hard: pods: "10" secrets: "20" selector: annotations: openshift.io/requester: <user-name> labels: null status: namespaces: - namespace: ns-one status: hard: pods: "10" secrets: "20" used: pods: "1" secrets: "9" total: hard: pods: "10" secrets: "20" used: pods: "1" secrets: "9"
apiVersion: v1
kind: ClusterResourceQuota
metadata:
name: for-user
spec:
quota:
hard:
pods: "10"
secrets: "20"
selector:
annotations:
openshift.io/requester: <user-name>
labels: null
status:
namespaces:
- namespace: ns-one
status:
hard:
pods: "10"
secrets: "20"
used:
pods: "1"
secrets: "9"
total:
hard:
pods: "10"
secrets: "20"
used:
pods: "1"
secrets: "9"
この複数プロジェクトのクォータの記述は、デフォルトのプロジェクト要求エンドポイントを使用して <user-name> によって要求されるすべてのプロジェクトを制御します。ここでは、10 Pod および 20 シークレットに制限されます。
同様にラベルに基づいてプロジェクトを選択するには、以下のコマンドを実行します。
oc create clusterresourcequota for-name \ --project-label-selector=name=frontend \ --hard=pods=10 --hard=secrets=20
$ oc create clusterresourcequota for-name \
--project-label-selector=name=frontend \
--hard=pods=10 --hard=secrets=20
これは以下の ClusterResourceQuota
オブジェクト定義を作成します。
apiVersion: v1 kind: ClusterResourceQuota metadata: creationTimestamp: null name: for-name spec: quota: hard: pods: "10" secrets: "20" selector: annotations: null labels: matchLabels: name: frontend
apiVersion: v1
kind: ClusterResourceQuota
metadata:
creationTimestamp: null
name: for-name
spec:
quota:
hard:
pods: "10"
secrets: "20"
selector:
annotations: null
labels:
matchLabels:
name: frontend
18.3. 適用可能な ClusterResourceQuotas
の表示
プロジェクト管理者は、各自のプロジェクトを制限する複数プロジェクトのクォータを作成したり、変更したりすることはできませんが、それぞれのプロジェクトに適用される複数プロジェクトのクォータを表示することはできます。プロジェクト管理者は、AppliedClusterResourceQuota
リソースを使ってこれを実行できます。
oc describe AppliedClusterResourceQuota
$ oc describe AppliedClusterResourceQuota
以下が生成されます。
Name: for-user Namespace: <none> Created: 19 hours ago Labels: <none> Annotations: <none> Label Selector: <null> AnnotationSelector: map[openshift.io/requester:<user-name>] Resource Used Hard -------- ---- ---- pods 1 10 secrets 9 20
Name: for-user
Namespace: <none>
Created: 19 hours ago
Labels: <none>
Annotations: <none>
Label Selector: <null>
AnnotationSelector: map[openshift.io/requester:<user-name>]
Resource Used Hard
-------- ---- ----
pods 1 10
secrets 9 20
18.4. 選択における粒度
クォータの割り当てを要求する際にロックに関して考慮する必要があるため、複数プロジェクトのクォータで選択されるアクティブなプロジェクトの数は重要な考慮点になります。単一の複数プロジェクトクォータで 100 を超えるプロジェクトを選択すると、それらのプロジェクトの API サーバーの応答に負の影響が及びます。