Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

18.2. 프로젝트 선택

주석 선택, 레이블 선택 또는 둘 다에 따라 프로젝트를 선택할 수 있습니다. 예를 들어 주석에 따라 프로젝트를 선택하려면 다음 명령을 실행합니다.

$ 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: 1
    hard:
      pods: "10"
      secrets: "20"
  selector:
    annotations: 2
      openshift.io/requester: <user-name>
    labels: null 3
status:
  namespaces: 4
  - namespace: ns-one
    status:
      hard:
        pods: "10"
        secrets: "20"
      used:
        pods: "1"
        secrets: "9"
  total: 5
    hard:
      pods: "10"
      secrets: "20"
    used:
      pods: "1"
      secrets: "9"
1
선택한 프로젝트를 통해 적용할 ResourceQuotaSpec 오브젝트입니다.
2
주석에 대한 간단한 키/값 선택기입니다.
3
프로젝트를 선택하는 데 사용할 수 있는 라벨 선택기입니다.
4
선택한 각 프로젝트의 현재 할당량 사용을 설명하는 네임스페이스별 맵입니다.
5
선택한 모든 프로젝트에서 집계한 사용량입니다.

이 다중 프로젝트 할당량 문서는 기본 프로젝트 요청 끝점을 사용하여 <user-name> 에서 요청하는 모든 프로젝트를 제어합니다. Pod 10개와 시크릿 20개로 제한되어 있습니다.

마찬가지로 라벨에 따라 프로젝트를 선택하려면 다음 명령을 실행합니다.

$ oc create clusterresourcequota for-name \ 1
    --project-label-selector=name=frontend \ 2
    --hard=pods=10 --hard=secrets=20
1
clusterresourcequotaclusterquota 는 모두 동일한 명령의 별칭입니다. for-nameclusterresourcequota 오브젝트의 이름입니다.
2
라벨에 따라 프로젝트를 선택하려면 --project-label-selector=key=value 형식을 사용하여 키-값 쌍을 제공합니다.

다음과 같은 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