Prevent hugo's wrong yaml rendering (#9851)

* Prevent hugo's wrong yaml rendering

* moved a couple of yaml descriptions to examples directory
* remove command prompt
* split each code snippet into command and output

* revert newline character

* add new test in examples_test.go

* change kind to ResourceQuota from List

* revert using examples/quota-objects-priority.yaml

* fix indent number

* unify file extension to yaml
This commit is contained in:
makocchi
2018-08-21 23:19:27 +09:00
committed by k8s-ci-robot
parent a6411149a1
commit 7e7f677fd4
@@ -390,7 +390,9 @@ Kubectl supports creating, updating, and viewing quotas:
```shell ```shell
kubectl create namespace myspace kubectl create namespace myspace
```
```shell
cat <<EOF > compute-resources.yaml cat <<EOF > compute-resources.yaml
apiVersion: v1 apiVersion: v1
kind: ResourceQuota kind: ResourceQuota
@@ -405,8 +407,13 @@ spec:
limits.memory: 2Gi limits.memory: 2Gi
requests.nvidia.com/gpu: 4 requests.nvidia.com/gpu: 4
EOF EOF
kubectl create -f ./compute-resources.yaml --namespace=myspace ```
```shell
kubectl create -f ./compute-resources.yaml --namespace=myspace
```
```shell
cat <<EOF > object-counts.yaml cat <<EOF > object-counts.yaml
apiVersion: v1 apiVersion: v1
kind: ResourceQuota kind: ResourceQuota
@@ -421,14 +428,27 @@ spec:
services: "10" services: "10"
services.loadbalancers: "2" services.loadbalancers: "2"
EOF EOF
kubectl create -f ./object-counts.yaml --namespace=myspace ```
```shell
kubectl create -f ./object-counts.yaml --namespace=myspace
```
```shell
kubectl get quota --namespace=myspace kubectl get quota --namespace=myspace
```
```shell
NAME AGE NAME AGE
compute-resources 30s compute-resources 30s
object-counts 32s object-counts 32s
```
```shell
kubectl describe quota compute-resources --namespace=myspace kubectl describe quota compute-resources --namespace=myspace
```
```shell
Name: compute-resources Name: compute-resources
Namespace: myspace Namespace: myspace
Resource Used Hard Resource Used Hard
@@ -439,9 +459,13 @@ pods 0 4
requests.cpu 0 1 requests.cpu 0 1
requests.memory 0 1Gi requests.memory 0 1Gi
requests.nvidia.com/gpu 0 4 requests.nvidia.com/gpu 0 4
```
```shell
kubectl describe quota object-counts --namespace=myspace kubectl describe quota object-counts --namespace=myspace
```
```shell
Name: object-counts Name: object-counts
Namespace: myspace Namespace: myspace
Resource Used Hard Resource Used Hard
@@ -459,12 +483,21 @@ using the syntax `count/<resource>.<group>`:
```shell ```shell
kubectl create namespace myspace kubectl create namespace myspace
```
```shell
kubectl create quota test --hard=count/deployments.extensions=2,count/replicasets.extensions=4,count/pods=3,count/secrets=4 --namespace=myspace kubectl create quota test --hard=count/deployments.extensions=2,count/replicasets.extensions=4,count/pods=3,count/secrets=4 --namespace=myspace
```
```shell
kubectl run nginx --image=nginx --replicas=2 --namespace=myspace kubectl run nginx --image=nginx --replicas=2 --namespace=myspace
```
```shell
kubectl describe quota --namespace=myspace kubectl describe quota --namespace=myspace
```
```shell
Name: test Name: test
Namespace: myspace Namespace: myspace
Resource Used Hard Resource Used Hard
@@ -503,8 +536,7 @@ With this mechanism, operators will be able to restrict usage of certain high pr
To enforce this, kube-apiserver flag `--admission-control-config-file` should be used to pass path to the following configuration file: To enforce this, kube-apiserver flag `--admission-control-config-file` should be used to pass path to the following configuration file:
```shell ```yaml
$ cat admission_config_file.yml
apiVersion: apiserver.k8s.io/v1alpha1 apiVersion: apiserver.k8s.io/v1alpha1
kind: AdmissionConfiguration kind: AdmissionConfiguration
plugins: plugins:
@@ -522,7 +554,7 @@ plugins:
Now, "cluster-services" pods will be allowed in only those namespaces where a quota object with a matching `scopeSelector` is present. Now, "cluster-services" pods will be allowed in only those namespaces where a quota object with a matching `scopeSelector` is present.
For example: For example:
```shell ```yaml
scopeSelector: scopeSelector:
matchExpressions: matchExpressions:
- operator : In - operator : In
@@ -530,7 +562,9 @@ For example:
values: ["cluster-services"] values: ["cluster-services"]
``` ```
**NOTE:** `scopeSelector` is an alpha field and feature gate `ResourceQuotaScopeSelectors` must be enabled before using it. {{< note >}}
**Note:** `scopeSelector` is an alpha field and feature gate `ResourceQuotaScopeSelectors` must be enabled before using it.
{{< /note >}}
See [LimitedResources](https://github.com/kubernetes/kubernetes/pull/36765) and [Quota supoport for priority class design doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/pod-priority-resourcequota.md) for more information. See [LimitedResources](https://github.com/kubernetes/kubernetes/pull/36765) and [Quota supoport for priority class design doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/pod-priority-resourcequota.md) for more information.