Fix inline YAML in resource quota (#9906)

Closes: #9905
This commit is contained in:
Qiming
2018-08-21 04:36:46 +08:00
committed by k8s-ci-robot
parent 1089ebbf41
commit 4050303130
@@ -213,13 +213,13 @@ works as follows:
- Pods in the cluster have one of the three priority classes, "low", "medium", "high". - Pods in the cluster have one of the three priority classes, "low", "medium", "high".
- One quota object is created for each priority. - One quota object is created for each priority.
1. Save the following YAML to a file `quota.yml`. Save the following YAML to a file `quota.yml`.
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: List kind: List
items: items:
- apiVersion: v1 - apiVersion: v1
kind: ResourceQuota kind: ResourceQuota
metadata: metadata:
name: pods-high name: pods-high
@@ -233,7 +233,7 @@ works as follows:
- operator : In - operator : In
scopeName: PriorityClass scopeName: PriorityClass
values: ["high"] values: ["high"]
- apiVersion: v1 - apiVersion: v1
kind: ResourceQuota kind: ResourceQuota
metadata: metadata:
name: pods-medium name: pods-medium
@@ -247,7 +247,7 @@ works as follows:
- operator : In - operator : In
scopeName: PriorityClass scopeName: PriorityClass
values: ["medium"] values: ["medium"]
- apiVersion: v1 - apiVersion: v1
kind: ResourceQuota kind: ResourceQuota
metadata: metadata:
name: pods-low name: pods-low
@@ -261,58 +261,59 @@ works as follows:
- operator : In - operator : In
scopeName: PriorityClass scopeName: PriorityClass
values: ["low"] values: ["low"]
``` ```
2. Apply it using `kubectl create`. Apply the YAML using `kubectl create`.
```shell ```shell
kubectl create -f ./quota.yml kubectl create -f ./quota.yml
resourcequota/pods-high created resourcequota/pods-high created
resourcequota/pods-medium created resourcequota/pods-medium created
resourcequota/pods-low created resourcequota/pods-low created
``` ```
3. Verify that `Used` quota is `0` using `kubectl describe quota`. Verify that `Used` quota is `0` using `kubectl describe quota`.
```shell ```shell
kubectl describe quota kubectl describe quota
Name: pods-high Name: pods-high
Namespace: default Namespace: default
Resource Used Hard Resource Used Hard
-------- ---- ---- -------- ---- ----
cpu 0 1k cpu 0 1k
memory 0 200Gi memory 0 200Gi
pods 0 10 pods 0 10
Name: pods-low Name: pods-low
Namespace: default Namespace: default
Resource Used Hard Resource Used Hard
-------- ---- ---- -------- ---- ----
cpu 0 5 cpu 0 5
memory 0 10Gi memory 0 10Gi
pods 0 10 pods 0 10
Name: pods-medium Name: pods-medium
Namespace: default Namespace: default
Resource Used Hard Resource Used Hard
-------- ---- ---- -------- ---- ----
cpu 0 10 cpu 0 10
memory 0 20Gi memory 0 20Gi
pods 0 10 pods 0 10
``` ```
4. Create a pod with priority "high". Save the following YAML to a
file `high-priority-pod.yml`.
```yaml Create a pod with priority "high". Save the following YAML to a
apiVersion: v1 file `high-priority-pod.yml`.
kind: Pod
metadata: ```yaml
apiVersion: v1
kind: Pod
metadata:
name: high-priority name: high-priority
spec: spec:
containers: containers:
- name: high-priority - name: high-priority
image: ubuntu image: ubuntu
@@ -326,46 +327,46 @@ works as follows:
memory: "10Gi" memory: "10Gi"
cpu: "500m" cpu: "500m"
priorityClassName: high priorityClassName: high
``` ```
Apply it with `kubectl create`. Apply it with `kubectl create`.
```shell ```shell
kubectl create -f ./high-priority-pod.yml kubectl create -f ./high-priority-pod.yml
``` ```
5. Verify that "Used" stats for "high" priority quota, `pods-high`, has changed and that Verify that "Used" stats for "high" priority quota, `pods-high`, has changed and that
the other two quotas are unchanged. the other two quotas are unchanged.
```shell ```shell
kubectl describe quota kubectl describe quota
Name: pods-high Name: pods-high
Namespace: default Namespace: default
Resource Used Hard Resource Used Hard
-------- ---- ---- -------- ---- ----
cpu 500m 1k cpu 500m 1k
memory 10Gi 200Gi memory 10Gi 200Gi
pods 1 10 pods 1 10
Name: pods-low Name: pods-low
Namespace: default Namespace: default
Resource Used Hard Resource Used Hard
-------- ---- ---- -------- ---- ----
cpu 0 5 cpu 0 5
memory 0 10Gi memory 0 10Gi
pods 0 10 pods 0 10
Name: pods-medium Name: pods-medium
Namespace: default Namespace: default
Resource Used Hard Resource Used Hard
-------- ---- ---- -------- ---- ----
cpu 0 10 cpu 0 10
memory 0 20Gi memory 0 20Gi
pods 0 10 pods 0 10
``` ```
`scopeSelector` supports the following values in the `operator` field: `scopeSelector` supports the following values in the `operator` field: