-
Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling in will reduce the number of Pods to the new desired state. Kubernetes also supports autoscaling of Pods, but it is outside of the scope of this tutorial. Scaling to zero is also possible, and it will terminate all Pods of the specified Deployment.
+
Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling in will reduce the number of Pods to the new desired state. Kubernetes also supports autoscaling of Pods, but it is outside of the scope of this tutorial. Scaling to zero is also possible, and it will terminate all Pods of the specified Deployment.
Running multiple instances of an application will require a way to distribute the traffic to all of them. Services have an integrated load-balancer that will distribute network traffic to all Pods of an exposed Deployment. Services will monitor continuously the running Pods using endpoints, to ensure the traffic is sent only to available Pods.
diff --git a/content/en/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume.md b/content/en/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume.md
index a47c589055c59..398b3b9e143cf 100644
--- a/content/en/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume.md
+++ b/content/en/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume.md
@@ -68,26 +68,29 @@ When a PersistentVolumeClaim is created, a PersistentVolume is dynamically provi
A [Secret](/docs/concepts/configuration/secret/) is an object that stores a piece of sensitive data like a password or key. The manifest files are already configured to use a Secret, but you have to create your own Secret.
-1. Create the Secret object from the following command:
+1. Create the Secret object from the following command. You will need to replace
+ `YOUR_PASSWORD` with the password you want to use.
- kubectl create secret generic mysql-pass --from-literal=password=YOUR_PASSWORD
+ ```
+ kubectl create secret generic mysql-pass --from-literal=password=YOUR_PASSWORD
+ ```
- {{< note >}}
- **Note:** Replace `YOUR_PASSWORD` with the password you want to apply.
- {{< /note >}}
-
2. Verify that the Secret exists by running the following command:
- kubectl get secrets
+ ```
+ kubectl get secrets
+ ```
- The response should be like this:
+ The response should be like this:
- NAME TYPE DATA AGE
- mysql-pass Opaque 1 42s
+ ```
+ NAME TYPE DATA AGE
+ mysql-pass Opaque 1 42s
+ ```
- {{< note >}}
- **Note:** To protect the Secret from exposure, neither `get` nor `describe` show its contents.
- {{< /note >}}
+{{< note >}}
+**Note:** To protect the Secret from exposure, neither `get` nor `describe` show its contents.
+{{< /note >}}
## Deploy MySQL
@@ -97,77 +100,96 @@ The following manifest describes a single-instance MySQL Deployment. The MySQL c
1. Deploy MySQL from the `mysql-deployment.yaml` file:
- kubectl create -f mysql-deployment.yaml
-
-2. Verify that a PersistentVolume got dynamically provisioned:
+ ```
+ kubectl create -f mysql-deployment.yaml
+ ```
- kubectl get pvc
+2. Verify that a PersistentVolume got dynamically provisioned. Note that it can
+ It can take up to a few minutes for the PVs to be provisioned and bound.
- {{< note >}}
- **Note:** It can take up to a few minutes for the PVs to be provisioned and bound.
- {{< /note >}}
+ ```
+ kubectl get pvc
+ ```
- The response should be like this:
+ The response should be like this:
- NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
- mysql-pv-claim Bound pvc-91e44fbf-d477-11e7-ac6a-42010a800002 20Gi RWO standard 29s
+ ```
+ NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
+ mysql-pv-claim Bound pvc-91e44fbf-d477-11e7-ac6a-42010a800002 20Gi RWO standard 29s
+ ```
3. Verify that the Pod is running by running the following command:
- kubectl get pods
+ ```
+ kubectl get pods
+ ```
- {{< note >}}
- **Note:** It can take up to a few minutes for the Pod's Status to be `RUNNING`.
- {{< /note >}}
+ **Note:** It can take up to a few minutes for the Pod's Status to be `RUNNING`.
- The response should be like this:
+ The response should be like this:
- NAME READY STATUS RESTARTS AGE
- wordpress-mysql-1894417608-x5dzt 1/1 Running 0 40s
+ ```
+ NAME READY STATUS RESTARTS AGE
+ wordpress-mysql-1894417608-x5dzt 1/1 Running 0 40s
+ ```
## Deploy WordPress
-The following manifest describes a single-instance WordPress Deployment and Service. It uses many of the same features like a PVC for persistent storage and a Secret for the password. But it also uses a different setting: `type: NodePort`. This setting exposes WordPress to traffic from outside of the cluster.
+The following manifest describes a single-instance WordPress Deployment and Service. It uses many of the same features like a PVC for persistent storage and a Secret for the password. But it also uses a different setting: `type: LoadBalancer`. This setting exposes WordPress to traffic from outside of the cluster.
{{< code file="mysql-wordpress-persistent-volume/wordpress-deployment.yaml" >}}
1. Create a WordPress Service and Deployment from the `wordpress-deployment.yaml` file:
- kubectl create -f wordpress-deployment.yaml
+ ```
+ kubectl create -f wordpress-deployment.yaml
+ ```
2. Verify that a PersistentVolume got dynamically provisioned:
- kubectl get pvc
+ ```
+ kubectl get pvc
+ ```
- {{< note >}}
- **Note:** It can take up to a few minutes for the PVs to be provisioned and bound.
- {{< /note >}}
+ **Note:** It can take up to a few minutes for the PVs to be provisioned and bound.
- The response should be like this:
+ The response should be like this:
- NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
- wp-pv-claim Bound pvc-e69d834d-d477-11e7-ac6a-42010a800002 20Gi RWO standard 7s
+ ```
+ NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
+ wp-pv-claim Bound pvc-e69d834d-d477-11e7-ac6a-42010a800002 20Gi RWO standard 7s
+ ```
3. Verify that the Service is running by running the following command:
- kubectl get services wordpress
+ ```
+ kubectl get services wordpress
+ ```
- The response should be like this:
+ The response should be like this:
- NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
- wordpress 10.0.0.89
80:32406/TCP 4m
+ ```
+ NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
+ wordpress 10.0.0.89 80:32406/TCP 4m
+ ```
- {{< note >}}
- **Note:** Minikube can only expose Services through `NodePort`.
The `EXTERNAL-IP` is always ``.
- {{< /note >}}
+ **Note:** Minikube can only expose Services through `NodePort`.
+
+ ```
+ The EXTERNAL-IP is always .
+ ```
4. Run the following command to get the IP Address for the WordPress Service:
- minikube service wordpress --url
+ ```
+ minikube service wordpress --url
+ ```
- The response should be like this:
+ The response should be like this:
- http://1.2.3.4:32406
+ ```
+ http://1.2.3.4:32406
+ ```
5. Copy the IP address, and load the page in your browser to view your site.
@@ -175,9 +197,9 @@ The following manifest describes a single-instance WordPress Deployment and Serv

- {{< warning >}}
- **Warning:** Do not leave your WordPress installation on this page. If another user finds it, they can set up a website on your instance and use it to serve malicious content.
Either install WordPress by creating a username and password or delete your instance.
- {{< /warning >}}
+{{< warning >}}
+**Warning:** Do not leave your WordPress installation on this page. If another user finds it, they can set up a website on your instance and use it to serve malicious content.
Either install WordPress by creating a username and password or delete your instance.
+{{< /warning >}}
{{% /capture %}}
@@ -185,16 +207,22 @@ The following manifest describes a single-instance WordPress Deployment and Serv
1. Run the following command to delete your Secret:
- kubectl delete secret mysql-pass
+ ```
+ kubectl delete secret mysql-pass
+ ```
2. Run the following commands to delete all Deployments and Services:
- kubectl delete deployment -l app=wordpress
- kubectl delete service -l app=wordpress
+ ```
+ kubectl delete deployment -l app=wordpress
+ kubectl delete service -l app=wordpress
+ ```
3. Run the following commands to delete the PersistentVolumeClaims. The dynamically provisioned PersistentVolumes will be automatically deleted.
- kubectl delete pvc -l app=wordpress
+ ```
+ kubectl delete pvc -l app=wordpress
+ ```
{{% /capture %}}
diff --git a/content/en/docs/user-guide/walkthrough/_index.md b/content/en/docs/user-guide/walkthrough/_index.md
index 91268edd08852..06eaddf2386db 100644
--- a/content/en/docs/user-guide/walkthrough/_index.md
+++ b/content/en/docs/user-guide/walkthrough/_index.md
@@ -19,7 +19,7 @@ In order for the kubectl usage examples to work, make sure you have an example d
## Kubectl CLI
-The easiest way to interact with Kubernetes is through the [kubectl](/docs/reference/kubectl/overview/) command-line interface.
+The easiest way to interact with Kubernetes is through the kubectl command-line interface.
For more info about kubectl, including its usage, commands, and parameters, see [Overview of kubectl](/docs/reference/kubectl/overview/).
diff --git a/content/en/docs/user-journeys/users/application-developer/advanced.md b/content/en/docs/user-journeys/users/application-developer/advanced.md
index 9bcd65440f81a..dde720f1b6425 100644
--- a/content/en/docs/user-journeys/users/application-developer/advanced.md
+++ b/content/en/docs/user-journeys/users/application-developer/advanced.md
@@ -106,7 +106,7 @@ If you do not have a {{< glossary_tooltip text="cluster operator" term_id="clust
The following topics are also useful for building more complex applications:
* {{< link text="Other points of extensibility within Kubernetes" url="/docs/concepts/overview/extending/" >}} - A conceptual overview of where you can hook into the Kubernetes architecture.
-* {{< link text="Kubernetes Client Libraries" url="/docs/reference/client-libraries/" >}} - Useful for building apps that need to interact heavily with the Kubernetes API.
+* {{< link text="Kubernetes Client Libraries" url="/docs/reference/using-api/client-libraries/" >}} - Useful for building apps that need to interact heavily with the Kubernetes API.
#### What's next
Congrats on completing the Application Developer user journey! You've covered the majority of features that Kubernetes has to offer. What now?
diff --git a/content/en/includes/federation-current-state.md b/content/en/includes/federation-current-state.md
index 56e4decdf3c2e..a1c59f2a1d300 100644
--- a/content/en/includes/federation-current-state.md
+++ b/content/en/includes/federation-current-state.md
@@ -1,7 +1 @@
-**Note:** `Federation V1`, the current Kubernetes federation API which reuses the Kubernetes API
-resources 'as is', is currently considered alpha for many of its features, and there is no clear
-path to evolve the API to GA. However, there is a `Federation V2` effort in progress to implement
-a dedicated federation API apart from the Kubernetes API. The details can be found at
-[sig-multicluster community page](https://github.com/kubernetes/community/tree/master/sig-multicluster).
-{: .note}
-
+**Note:** `Federation V1`, the current Kubernetes federation API which reuses the Kubernetes API resources 'as is', is currently considered alpha for many of its features, and there is no clear path to evolve the API to GA. However, there is a `Federation V2` effort in progress to implement a dedicated federation API apart from the Kubernetes API. The details can be found at [sig-multicluster community page](https://github.com/kubernetes/community/tree/master/sig-multicluster).
diff --git a/layouts/docs/docsportal_home.html b/layouts/docs/docsportal_home.html
index cfd6d4bec45e4..ae0de8edcc119 100644
--- a/layouts/docs/docsportal_home.html
+++ b/layouts/docs/docsportal_home.html
@@ -36,8 +36,10 @@ {{ .Title }}
- Kubernetes is an open source system for managing
containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.
- The open source project is hosted by the Cloud Native Computing Foundation (
CNCF).
+
+ Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.
+ The open source project is hosted by the Cloud Native Computing Foundation (CNCF).
+
diff --git a/layouts/partials/templates/blocks.html b/layouts/partials/templates/blocks.html
index 280aa6aa5d14b..765b884ac70c2 100644
--- a/layouts/partials/templates/blocks.html
+++ b/layouts/partials/templates/blocks.html
@@ -9,8 +9,10 @@
{{ $section := $.ctx.Scratch.Get "section" }}
{{ $headers := findRE "
(.|\n)*?" $section }}
{{ range $headers }}
-{{ $header := . | replaceRE "?h2.*?>" "" | htmlUnescape }}
-{{ $header }}
+{{ $id := . | strings.TrimPrefix ".*" "" }}
+{{ $header := . | replaceRE "?h2.*?>" "" | htmlUnescape | safeHTML }}
+
{{ $header }}
{{ end }}
{{ $.ctx.Scratch.Add "sections" $section }}
{{ end }}
diff --git a/static/_redirects b/static/_redirects
index 841fb91380d39..1e2782722e712 100644
--- a/static/_redirects
+++ b/static/_redirects
@@ -174,8 +174,10 @@
/docs/getting-started-guides/centos/* /docs/setup/independent/create-cluster-kubeadm/ 301
/docs/hellonode/ /docs/tutorials/stateless-application/hello-minikube/ 301
+/docs/home/contribute/stage-documentation-changes/ /docs/home/contribute/create-pull-request/ 301
/docs/home/coreos/ /docs/getting-started-guides/coreos/ 301
-/docs/home/deprecation-policy/ /docs/reference/deprecation-policy/ 301
+/docs/home/deprecation-policy/ /docs/reference/using-api/deprecation-policy/ 301
+/docs/reference/deprecation-policy/ /docs/reference/using-api/deprecation-policy/ 301
/docs/reference/federation/v1beta1/definitions/ /docs/reference/federation/extensions/v1beta1/definitions/ 301
/docs/reference/federation/v1beta1/operations/ /docs/reference/federation/extensions/v1beta1/operations/ 301
@@ -196,8 +198,8 @@
/docs/reference/generated/kubefed_options/ /docs/reference/setup-tools/kubefed/kubefed-options/ 301
/docs/reference/generated/kubefed_unjoin/ /docs/reference/setup-tools/kubefed/kubefed-unjoin/ 301
/docs/reference/generated/kubefed_version/ /docs/reference/setup-tools/kubefed/kubefed-version/ 301
-
/docs/reference/kubectl/kubectl/kubectl_*.md /docs/reference/generated/kubectl/kubectl-commands#:splat 301
+/docs/reference/workloads-18-19/ https://v1-9.docs.kubernetes.io/docs/reference/workloads-18-19/ 301
/docs/reporting-security-issues/ /security/ 301
diff --git a/static/css/styles.css b/static/css/styles.css
index 6857fb7fcc084..2ef22b423f08a 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -508,7 +508,7 @@ html.search #docsContent h1 { margin-bottom: 0; border-bottom: 0; padding-bottom
#video { height: 200px; }
-#video { width: 100%; position: relative; background-image: url(/images/kub_video_banner_box.jpg); background-position: center center; background-size: cover; }
+#video { width: 100%; position: relative; background-image: url(/images/kub_video_banner_homepage.jpg); background-position: center center; background-size: cover; }
#video > .light-text { display: none; position: absolute; top: 50%; left: 75%; width: 525px; padding-right: 80px; transform: translate(-50%, -50%); color: white; }
@@ -859,7 +859,7 @@ html.search #docsContent h1 { margin-bottom: 0; border-bottom: 0; padding-bottom
#oceanNodes main:nth-child(1) h3, #oceanNodes main:nth-child(1) p { text-align: left; }
#oceanNodes main:nth-child(1) .image-wrapper { position: absolute; max-width: 48%; transform: translateY(-50%); }
#oceanNodes main:nth-child(1) .image-wrapper img { max-width: 425px; }
- #video { height: 550px; position: relative; background-image: url(../images/kub_video_banner_box.jpg); background-position: center center; background-size: cover; }
+ #video { height: 550px; position: relative; background-image: url(../images/kub_video_banner_homepage.jpg); background-position: center center; background-size: cover; }
#talkToUs h4 br { display: block; }
#talkToUs #bigSocial div { width: calc(25% - 18px); }
#talkToUs #bigSocial div + div { margin-left: 20px; }
diff --git a/static/docs/reference/generated/kubectl/scroll.js b/static/docs/reference/generated/kubectl/scroll.js
index 67fee8729e449..6639f62895616 100644
--- a/static/docs/reference/generated/kubectl/scroll.js
+++ b/static/docs/reference/generated/kubectl/scroll.js
@@ -187,10 +187,10 @@ $(document).ready(function() {
var scrollPosition = $(window).scrollTop();
scrollActions(scrollPosition);
checkActiveElement(flatToc, scrollPosition);
- // TODO: prevent scroll on sidebar from propogating to window
+ // TODO: prevent scroll on sidebar from propagating to window
$(window).on('scroll', function(event) {
var scrollPosition = $(window).scrollTop();
var activeSectionTokens = scrollActions(scrollPosition);
var activeElemToken = checkActiveElement(flatToc, scrollPosition);
});
-});
\ No newline at end of file
+});
diff --git a/static/docs/reference/generated/kubernetes-api/v1.10/scroll.js b/static/docs/reference/generated/kubernetes-api/v1.10/scroll.js
index 67fee8729e449..6639f62895616 100644
--- a/static/docs/reference/generated/kubernetes-api/v1.10/scroll.js
+++ b/static/docs/reference/generated/kubernetes-api/v1.10/scroll.js
@@ -187,10 +187,10 @@ $(document).ready(function() {
var scrollPosition = $(window).scrollTop();
scrollActions(scrollPosition);
checkActiveElement(flatToc, scrollPosition);
- // TODO: prevent scroll on sidebar from propogating to window
+ // TODO: prevent scroll on sidebar from propagating to window
$(window).on('scroll', function(event) {
var scrollPosition = $(window).scrollTop();
var activeSectionTokens = scrollActions(scrollPosition);
var activeElemToken = checkActiveElement(flatToc, scrollPosition);
});
-});
\ No newline at end of file
+});
diff --git a/static/images/KubeCon_EU_Community.jpg b/static/images/KubeCon_EU_Community.jpg
index 51584150ae264..5b50d2b18a0b8 100644
Binary files a/static/images/KubeCon_EU_Community.jpg and b/static/images/KubeCon_EU_Community.jpg differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/containerd.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/containerd.png
new file mode 100644
index 0000000000000..5d74665792d47
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/containerd.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cpu.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cpu.png
new file mode 100644
index 0000000000000..a0f55b47b6224
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cpu.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cri-containerd.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cri-containerd.png
new file mode 100644
index 0000000000000..1d4131f169616
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cri-containerd.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-pods-filter.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-pods-filter.png
new file mode 100644
index 0000000000000..a8ada1e59a470
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-pods-filter.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-pods.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-pods.png
new file mode 100644
index 0000000000000..cc28e1e1d8b26
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-pods.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-ps.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-ps.png
new file mode 100644
index 0000000000000..0643f3dcb0bc0
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/crictl-ps.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/docker-ce.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/docker-ce.png
new file mode 100644
index 0000000000000..9233e2a2c3510
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/docker-ce.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/docker-ps.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/docker-ps.png
new file mode 100644
index 0000000000000..ee2ff07ceab39
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/docker-ps.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/latency.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/latency.png
new file mode 100644
index 0000000000000..67a4b0a4caea8
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/latency.png differ
diff --git a/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/memory.png b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/memory.png
new file mode 100644
index 0000000000000..bc0d3302ac975
Binary files /dev/null and b/static/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/memory.png differ
diff --git a/static/images/blog/2018-05-30-say-hello-to-discuss-kubernetes.png b/static/images/blog/2018-05-30-say-hello-to-discuss-kubernetes.png
new file mode 100755
index 0000000000000..03243ffcdf1c2
Binary files /dev/null and b/static/images/blog/2018-05-30-say-hello-to-discuss-kubernetes.png differ
diff --git a/static/images/kub_video_banner_box.jpg b/static/images/kub_video_banner_box.jpg
deleted file mode 100644
index bdc024a1e3f62..0000000000000
Binary files a/static/images/kub_video_banner_box.jpg and /dev/null differ
diff --git a/static/images/kub_video_banner_homepage.jpg b/static/images/kub_video_banner_homepage.jpg
new file mode 100644
index 0000000000000..d70306b9c5497
Binary files /dev/null and b/static/images/kub_video_banner_homepage.jpg differ
diff --git a/test/examples_test.go b/test/examples_test.go
index bc94dec7eccd0..55d0fa6a92f63 100644
--- a/test/examples_test.go
+++ b/test/examples_test.go
@@ -369,7 +369,7 @@ func TestExampleObjectSchemas(t *testing.T) {
"memory-defaults-pod": {&api.Pod{}},
"memory-defaults-pod-2": {&api.Pod{}},
"memory-defaults-pod-3": {&api.Pod{}},
- "my-scheduler": {&extensions.Deployment{}},
+ "my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}},
"namespace-dev": {&api.Namespace{}},
"namespace-prod": {&api.Namespace{}},
"persistent-volume-label-initializer-config": {&admissionregistration.InitializerConfiguration{}},
@@ -421,15 +421,15 @@ func TestExampleObjectSchemas(t *testing.T) {
"tcp-liveness-readiness": {&api.Pod{}},
},
"docs/tasks/debug-application-cluster": {
- "counter-pod": {&api.Pod{}},
- "event-exporter-deploy": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}},
- "fluentd-gcp-configmap": {&api.ConfigMap{}},
- "fluentd-gcp-ds": {&extensions.DaemonSet{}},
- "nginx-dep": {&extensions.Deployment{}},
- "node-problem-detector": {&extensions.DaemonSet{}},
- "node-problem-detector-configmap": {&extensions.DaemonSet{}},
- "shell-demo": {&api.Pod{}},
- "termination": {&api.Pod{}},
+ "counter-pod": {&api.Pod{}},
+ "event-exporter-deploy": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}},
+ "fluentd-gcp-configmap": {&api.ConfigMap{}},
+ "fluentd-gcp-ds": {&extensions.DaemonSet{}},
+ "nginx-dep": {&extensions.Deployment{}},
+ "node-problem-detector": {&extensions.DaemonSet{}},
+ "node-problem-detector-configmap": {&extensions.DaemonSet{}},
+ "shell-demo": {&api.Pod{}},
+ "termination": {&api.Pod{}},
},
// TODO: decide whether federation examples should be added
"docs/tasks/inject-data-application": {
@@ -456,8 +456,8 @@ func TestExampleObjectSchemas(t *testing.T) {
"secret-pod": {&api.Pod{}},
},
"docs/tasks/job": {
- "cronjob": {&batch.CronJob{}},
- "job": {&batch.Job{}},
+ "cronjob": {&batch.CronJob{}},
+ "job": {&batch.Job{}},
},
"docs/tasks/job/coarse-parallel-processing-work-queue": {
"job": {&batch.Job{}},
@@ -620,12 +620,19 @@ func TestExampleObjectSchemas(t *testing.T) {
var sampleRegexp = regexp.MustCompile("(?ms)^```(?:(?Pyaml)\\w*\\n(?P.+?)|\\w*\\n(?P\\{.+?\\}))\\n^```")
var subsetRegexp = regexp.MustCompile("(?ms)\\.{3}")
+// Validates examples embedded in Markdown files.
func TestReadme(t *testing.T) {
+ // BlockVolume required for local volume example
+ utilfeature.DefaultFeatureGate.Set("BlockVolume=true")
+
paths := []struct {
file string
- expectedType []runtime.Object
+ expectedType []runtime.Object // List of all valid types for the whole doc
}{
- {"../content/en/docs/concepts/storage/volumes.md", []runtime.Object{&api.Pod{}}},
+ {"../content/en/docs/concepts/storage/volumes.md", []runtime.Object{
+ &api.Pod{},
+ &api.PersistentVolume{},
+ }},
}
for _, path := range paths {
@@ -639,7 +646,6 @@ func TestReadme(t *testing.T) {
if matches == nil {
continue
}
- ix := 0
for _, match := range matches {
var content, subtype string
for i, name := range sampleRegexp.SubexpNames() {
@@ -655,21 +661,23 @@ func TestReadme(t *testing.T) {
continue
}
- var expectedType runtime.Object
- if len(path.expectedType) == 1 {
- expectedType = path.expectedType[0]
- } else {
- expectedType = path.expectedType[ix]
- ix++
- }
json, err := yaml.ToJSON([]byte(content))
if err != nil {
t.Errorf("%s could not be converted to JSON: %v\n%s", path, err, string(content))
}
- if err := runtime.DecodeInto(testapi.Default.Codec(), json, expectedType); err != nil {
+
+ var expectedType runtime.Object
+ for _, expectedType = range path.expectedType {
+ err = runtime.DecodeInto(testapi.Default.Codec(), json, expectedType)
+ if err == nil {
+ break
+ }
+ }
+ if err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(content))
continue
}
+
if errors := validateObject(expectedType); len(errors) > 0 {
t.Errorf("%s did not validate correctly: %v", path, errors)
}