Fix inline YAML in resource quota (#9906)

Closes: #9905
pull/9918/merge
Qiming 2018-08-21 04:36:46 +08:00 committed by k8s-ci-robot
parent 1089ebbf41
commit 4050303130
1 changed files with 133 additions and 132 deletions

View File

@ -213,13 +213,13 @@ works as follows:
- Pods in the cluster have one of the three priority classes, "low", "medium", "high".
- 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
apiVersion: v1
kind: List
items:
- apiVersion: v1
```yaml
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ResourceQuota
metadata:
name: pods-high
@ -233,7 +233,7 @@ works as follows:
- operator : In
scopeName: PriorityClass
values: ["high"]
- apiVersion: v1
- apiVersion: v1
kind: ResourceQuota
metadata:
name: pods-medium
@ -247,7 +247,7 @@ works as follows:
- operator : In
scopeName: PriorityClass
values: ["medium"]
- apiVersion: v1
- apiVersion: v1
kind: ResourceQuota
metadata:
name: pods-low
@ -261,58 +261,59 @@ works as follows:
- operator : In
scopeName: PriorityClass
values: ["low"]
```
```
2. Apply it using `kubectl create`.
Apply the YAML using `kubectl create`.
```shell
kubectl create -f ./quota.yml
```shell
kubectl create -f ./quota.yml
resourcequota/pods-high created
resourcequota/pods-medium created
resourcequota/pods-low created
```
resourcequota/pods-high created
resourcequota/pods-medium 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
kubectl describe quota
```shell
kubectl describe quota
Name: pods-high
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 1k
memory 0 200Gi
pods 0 10
Name: pods-high
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 1k
memory 0 200Gi
pods 0 10
Name: pods-low
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 5
memory 0 10Gi
pods 0 10
Name: pods-low
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 5
memory 0 10Gi
pods 0 10
Name: pods-medium
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 10
memory 0 20Gi
pods 0 10
```
4. Create a pod with priority "high". Save the following YAML to a
file `high-priority-pod.yml`.
Name: pods-medium
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 10
memory 0 20Gi
pods 0 10
```
```yaml
apiVersion: v1
kind: Pod
metadata:
Create a pod with priority "high". Save the following YAML to a
file `high-priority-pod.yml`.
```yaml
apiVersion: v1
kind: Pod
metadata:
name: high-priority
spec:
spec:
containers:
- name: high-priority
image: ubuntu
@ -326,46 +327,46 @@ works as follows:
memory: "10Gi"
cpu: "500m"
priorityClassName: high
```
```
Apply it with `kubectl create`.
Apply it with `kubectl create`.
```shell
kubectl create -f ./high-priority-pod.yml
```
```shell
kubectl create -f ./high-priority-pod.yml
```
5. Verify that "Used" stats for "high" priority quota, `pods-high`, has changed and that
the other two quotas are unchanged.
Verify that "Used" stats for "high" priority quota, `pods-high`, has changed and that
the other two quotas are unchanged.
```shell
kubectl describe quota
```shell
kubectl describe quota
Name: pods-high
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 500m 1k
memory 10Gi 200Gi
pods 1 10
Name: pods-high
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 500m 1k
memory 10Gi 200Gi
pods 1 10
Name: pods-low
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 5
memory 0 10Gi
pods 0 10
Name: pods-low
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 5
memory 0 10Gi
pods 0 10
Name: pods-medium
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 10
memory 0 20Gi
pods 0 10
```
Name: pods-medium
Namespace: default
Resource Used Hard
-------- ---- ----
cpu 0 10
memory 0 20Gi
pods 0 10
```
`scopeSelector` supports the following values in the `operator` field: