Consolidate YAML files [part-2] (#9236)
Changes that will help upcoming consolidation work: - Add variable `githubWebsiteRaw` to config.toml to facilitate building links to raw YAML files - Revise `codenew` shortcode to generate links to raw YAML files instead of github.com file view; - Rename `artifacts` directory to `examples` to better reflect its usage; Accompanied changes as show cases: - Moved `deployment.yaml`, `deployment-update.yaml` and `deployment-scale.yaml` to the new `examples/application` subdirectory; - Removed duplicate instances of the above YAML files in other directories; - Update example_test.go to test the relocated YAML files and removed testing for files that no longer needed.
This commit is contained in:
parent
767bd9371e
commit
a3415f6228
|
|
@ -55,6 +55,7 @@ deprecated = false
|
||||||
currentUrl = "https://kubernetes.io/docs/home/"
|
currentUrl = "https://kubernetes.io/docs/home/"
|
||||||
nextUrl = "http://kubernetes-io-vnext-staging.netlify.com/"
|
nextUrl = "http://kubernetes-io-vnext-staging.netlify.com/"
|
||||||
githubWebsiteRepo = "github.com/kubernetes/website"
|
githubWebsiteRepo = "github.com/kubernetes/website"
|
||||||
|
githubWebsiteRaw = "raw.githubusercontent.com/kubernetes/website"
|
||||||
|
|
||||||
[[params.versions]]
|
[[params.versions]]
|
||||||
fullversion = "v1.10.3"
|
fullversion = "v1.10.3"
|
||||||
|
|
|
||||||
|
|
@ -856,7 +856,7 @@ You should see some services. You should also see "mirror pods" for the apiserv
|
||||||
|
|
||||||
### Try Examples
|
### Try Examples
|
||||||
|
|
||||||
At this point you should be able to run through one of the basic examples, such as the [nginx example](/docs/tutorials/stateless-application/deployment.yaml).
|
At this point you should be able to run through one of the basic examples, such as the [nginx example](/examples/application/deployment.yaml).
|
||||||
|
|
||||||
### Running the Conformance Test
|
### Running the Conformance Test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ a Deployment that runs the nginx:1.7.9 Docker image:
|
||||||
|
|
||||||
1. Create a Deployment based on the YAML file:
|
1. Create a Deployment based on the YAML file:
|
||||||
|
|
||||||
kubectl apply -f https://k8s.io/docs/artifacts/application/deployment.yaml
|
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
|
||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
|
|
||||||
|
|
@ -99,11 +99,11 @@ a Deployment that runs the nginx:1.7.9 Docker image:
|
||||||
You can update the deployment by applying a new YAML file. This YAML file
|
You can update the deployment by applying a new YAML file. This YAML file
|
||||||
specifies that the deployment should be updated to use nginx 1.8.
|
specifies that the deployment should be updated to use nginx 1.8.
|
||||||
|
|
||||||
{{< code file="deployment-update.yaml" >}}
|
{{< codenew file="application/deployment-update.yaml" >}}
|
||||||
|
|
||||||
1. Apply the new YAML file:
|
1. Apply the new YAML file:
|
||||||
|
|
||||||
kubectl apply -f https://k8s.io/docs/tasks/run-application/deployment-update.yaml
|
kubectl apply -f https://k8s.io/examples/application/deployment-update.yaml
|
||||||
|
|
||||||
1. Watch the deployment create pods with new names and delete the old pods:
|
1. Watch the deployment create pods with new names and delete the old pods:
|
||||||
|
|
||||||
|
|
@ -115,11 +115,11 @@ You can increase the number of pods in your Deployment by applying a new YAML
|
||||||
file. This YAML file sets `replicas` to 4, which specifies that the Deployment
|
file. This YAML file sets `replicas` to 4, which specifies that the Deployment
|
||||||
should have four pods:
|
should have four pods:
|
||||||
|
|
||||||
{{< code file="deployment-scale.yaml" >}}
|
{{< codenew file="application/deployment-scale.yaml" >}}
|
||||||
|
|
||||||
1. Apply the new YAML file:
|
1. Apply the new YAML file:
|
||||||
|
|
||||||
kubectl apply -f https://k8s.io/docs/tasks/run-application/deployment-scale.yaml
|
kubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml
|
||||||
|
|
||||||
1. Verify that the Deployment has four pods:
|
1. Verify that the Deployment has four pods:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: nginx-deployment
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: nginx
|
|
||||||
replicas: 2
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: nginx
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: nginx
|
|
||||||
image: nginx:1.8 # Update the version of nginx from 1.7.9 to 1.8
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: nginx-deployment
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: nginx
|
|
||||||
replicas: 2 # tells deployment to run 2 pods matching the template
|
|
||||||
template: # create pods using pod definition in this template
|
|
||||||
metadata:
|
|
||||||
# unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
|
|
||||||
# generated from the deployment name
|
|
||||||
labels:
|
|
||||||
app: nginx
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: nginx
|
|
||||||
image: nginx:1.7.9
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
|
|
@ -65,7 +65,7 @@ A Deployment object defines a Pod creation template (a "cookie-cutter" if you wi
|
||||||
|
|
||||||
Here is a Deployment that instantiates two nginx Pods:
|
Here is a Deployment that instantiates two nginx Pods:
|
||||||
|
|
||||||
{{< code file="deployment.yaml" >}}
|
{{< codenew file="application/deployment.yaml" >}}
|
||||||
|
|
||||||
|
|
||||||
### Deployment Management
|
### Deployment Management
|
||||||
|
|
@ -73,7 +73,7 @@ Here is a Deployment that instantiates two nginx Pods:
|
||||||
Create an nginx Deployment:
|
Create an nginx Deployment:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl create -f https://k8s.io/docs/tutorials/deployment.yaml
|
kubectl create -f https://k8s.io/examples/application/deployment.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
List all Deployments:
|
List all Deployments:
|
||||||
|
|
@ -91,10 +91,10 @@ kubectl get pods -l app=nginx
|
||||||
Upgrade the nginx container from 1.7.9 to 1.8 by changing the Deployment and calling `apply`. The following config
|
Upgrade the nginx container from 1.7.9 to 1.8 by changing the Deployment and calling `apply`. The following config
|
||||||
contains the desired changes:
|
contains the desired changes:
|
||||||
|
|
||||||
{{< code file="deployment-update.yaml" >}}
|
{{< codenew file="application/deployment-update.yaml" >}}
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply -f https://k8s.io/docs/tutorials/deployment-update.yaml
|
kubectl apply -f https://k8s.io/examples/application/deployment-update.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Watch the Deployment create Pods with new names and delete the old Pods:
|
Watch the Deployment create Pods with new names and delete the old Pods:
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: nginx-deployment
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: nginx
|
|
||||||
replicas: 2 # tells deployment to run 2 pods matching the template
|
|
||||||
template: # create pods using pod definition in this template
|
|
||||||
metadata:
|
|
||||||
# unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
|
|
||||||
# generated from the deployment name
|
|
||||||
labels:
|
|
||||||
app: nginx
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: nginx
|
|
||||||
image: nginx:1.7.9
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
{{ $codelang := .Get "language" | default (path.Ext $file | strings.TrimPrefix ".") }}
|
{{ $codelang := .Get "language" | default (path.Ext $file | strings.TrimPrefix ".") }}
|
||||||
{{ $fileDir := path.Split $file }}
|
{{ $fileDir := path.Split $file }}
|
||||||
{{ $bundlePath := path.Join .Page.Dir $fileDir.Dir }}
|
{{ $bundlePath := path.Join .Page.Dir $fileDir.Dir }}
|
||||||
{{ $filename := printf "/content/%s/artifacts/%s" .Page.Lang $file | safeURL }}
|
{{ $filename := printf "/content/%s/examples/%s" .Page.Lang $file | safeURL }}
|
||||||
{{ $ghlink := printf "https://%s/blob/master%s" .Page.Site.Params.githubWebsiteRepo $filename | safeURL }}
|
{{ $ghlink := printf "https://%s/master%s" .Page.Site.Params.githubWebsiteRaw $filename | safeURL }}
|
||||||
{{/* First assume this is a bundle and the file is inside it. */}}
|
{{/* First assume this is a bundle and the file is inside it. */}}
|
||||||
{{ $resource := $p.Resources.GetMatch (printf "%s*" $file ) }}
|
{{ $resource := $p.Resources.GetMatch (printf "%s*" $file ) }}
|
||||||
{{ with $resource }}
|
{{ with $resource }}
|
||||||
|
|
|
||||||
|
|
@ -440,13 +440,13 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||||
"redis-pod": {&api.Pod{}},
|
"redis-pod": {&api.Pod{}},
|
||||||
"redis-service": {&api.Service{}},
|
"redis-service": {&api.Service{}},
|
||||||
},
|
},
|
||||||
"artifacts/application": {
|
"examples/application": {
|
||||||
"deployment": {&extensions.Deployment{}},
|
"deployment": {&extensions.Deployment{}},
|
||||||
|
"deployment-scale": {&extensions.Deployment{}},
|
||||||
|
"deployment-update": {&extensions.Deployment{}},
|
||||||
},
|
},
|
||||||
"docs/tasks/run-application": {
|
"docs/tasks/run-application": {
|
||||||
"deployment-patch-demo": {&extensions.Deployment{}},
|
"deployment-patch-demo": {&extensions.Deployment{}},
|
||||||
"deployment-scale": {&extensions.Deployment{}},
|
|
||||||
"deployment-update": {&extensions.Deployment{}},
|
|
||||||
"hpa-php-apache": {&autoscaling.HorizontalPodAutoscaler{}},
|
"hpa-php-apache": {&autoscaling.HorizontalPodAutoscaler{}},
|
||||||
"mysql-configmap": {&api.ConfigMap{}},
|
"mysql-configmap": {&api.ConfigMap{}},
|
||||||
"mysql-deployment": {&api.Service{}, &extensions.Deployment{}},
|
"mysql-deployment": {&api.Service{}, &extensions.Deployment{}},
|
||||||
|
|
@ -479,11 +479,6 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||||
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
||||||
"wordpress-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
"wordpress-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
||||||
},
|
},
|
||||||
"docs/tutorials/stateless-application": {
|
|
||||||
"deployment": {&extensions.Deployment{}},
|
|
||||||
"deployment-scale": {&extensions.Deployment{}},
|
|
||||||
"deployment-update": {&extensions.Deployment{}},
|
|
||||||
},
|
|
||||||
"docs/tutorials/stateless-application/guestbook": {
|
"docs/tutorials/stateless-application/guestbook": {
|
||||||
"frontend-deployment": {&extensions.Deployment{}},
|
"frontend-deployment": {&extensions.Deployment{}},
|
||||||
"frontend-service": {&api.Service{}},
|
"frontend-service": {&api.Service{}},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue