diff --git a/site/content/docs/user/configuration.md b/site/content/docs/user/configuration.md index f423daf679..cf5d9bcbe7 100644 --- a/site/content/docs/user/configuration.md +++ b/site/content/docs/user/configuration.md @@ -53,5 +53,5 @@ NOTE: not all options are documented yet! We will fix this with time, PRs welco Extra mounts can be used to pass through storage on the host to a kind node for persisting data, mounting through code etc. -{{< codefromfile file="examples/config-with-mounts.yaml" lang="yaml" >}} +{{< codeFromFile file="static/examples/config-with-mounts.yaml" lang="yaml" >}} diff --git a/site/content/docs/user/ingress.md b/site/content/docs/user/ingress.md index 9bd186bcc8..79e3a8144c 100644 --- a/site/content/docs/user/ingress.md +++ b/site/content/docs/user/ingress.md @@ -31,7 +31,7 @@ The following ingress controllers are known to work: Create a kind cluster with `extraPortMappings` and `node-labels`. -```shell script +{{< codeFromInline lang="bash" >}} cat <}} + Apply the [mandatory ingress-nginx components](https://kubernetes.github.io/ingress-nginx/deploy/#prerequisite-generic-deployment-command). -```shell script +{{< codeFromInline lang="bash" >}} kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml -``` +{{< /codeFromInline >}} + Apply kind specific patches to forward the hostPorts to the ingress controller, set taint tolerations and schedule it to the custom labelled node. -{{< codefromfile file="examples/ingress/nginx/patch.json" lang="json" >}} +```json +{{% readFile "static/examples/ingress/nginx/patch.json" %}} +``` + +Apply it by running: -{{% mdwithcopy lang="bash" %}} -kubectl patch deployments -n ingress-nginx nginx-ingress-controller -p '{{< minify file="examples/ingress/nginx/patch.json" >}}' -{{% /mdwithcopy %}} +{{< codeFromInline lang="bash" >}} +kubectl patch deployments -n ingress-nginx nginx-ingress-controller -p '{{< minify file="static/examples/ingress/nginx/patch.json" >}}' +{{< /codeFromInline >}} Now the Ingress is all setup to be used. @@ -76,19 +82,21 @@ Refer [Using Ingress](#using-ingress) for a basic example usage. The following example creates simple http-echo services and an Ingress object to route to these services. -{{< codefromfile file="examples/ingress/usage.yaml" lang="yaml" >}} +```yaml +{{< readFile "static/examples/ingress/usage.yaml" >}} +``` Apply the contents -{{% mdwithcopy lang="bash" %}} -kubectl apply -f {{< absurl "examples/ingress/nginx/example.yaml" >}} -{{% /mdwithcopy %}} +{{< codeFromInline lang="bash" >}} +kubectl apply -f {{< absURL "examples/ingress/usage.yaml" >}} +{{< /codeFromInline >}} Now verify that the ingress works -{{% mdwithcopy lang="bash" %}} +{{< codeFromInline lang="bash" >}} # should output "foo" curl localhost/foo # should output "bar" curl localhost/bar -{{% /mdwithcopy %}} +{{< /codeFromInline >}} diff --git a/site/content/docs/user/local-registry.md b/site/content/docs/user/local-registry.md index 89bb9b967d..046b439911 100644 --- a/site/content/docs/user/local-registry.md +++ b/site/content/docs/user/local-registry.md @@ -17,7 +17,7 @@ The following recipe leverages this to enable a local registry. The following shell script will create a local docker registry and a kind cluster with it enabled. -{{< codefromfile file="static/examples/kind-with-registry.sh" >}} +{{< codeFromFile file="static/examples/kind-with-registry.sh" >}} ## Using The Registry diff --git a/site/content/docs/user/private-registries.md b/site/content/docs/user/private-registries.md index 780b43e52c..1ed30cecdf 100644 --- a/site/content/docs/user/private-registries.md +++ b/site/content/docs/user/private-registries.md @@ -62,7 +62,7 @@ If you do this then kubelet must be restarted on each node to pick up the new cr An example shell snippet for generating a [gcr.io][GCR] cred file on your host machine using Access Tokens: -{{< codefromfile file="static/examples/kind-gcr.sh" >}} +{{< codeFromFile file="static/examples/kind-gcr.sh" >}} ### Use a Service Account diff --git a/site/layouts/shortcodes/absurl.html b/site/layouts/shortcodes/absURL.html similarity index 68% rename from site/layouts/shortcodes/absurl.html rename to site/layouts/shortcodes/absURL.html index 181e88eecc..b07e7fc23a 100644 --- a/site/layouts/shortcodes/absurl.html +++ b/site/layouts/shortcodes/absURL.html @@ -1,2 +1,2 @@ {{/* the one input should be a relative url */}} -{{- .Get 0 | absURL }} \ No newline at end of file +{{- .Get 0 | absURL }} diff --git a/site/layouts/shortcodes/codefromfile.html b/site/layouts/shortcodes/codeFromFile.html similarity index 93% rename from site/layouts/shortcodes/codefromfile.html rename to site/layouts/shortcodes/codeFromFile.html index c4ada9f096..8b903d3a42 100644 --- a/site/layouts/shortcodes/codefromfile.html +++ b/site/layouts/shortcodes/codeFromFile.html @@ -1,4 +1,4 @@ -{{ $file := printf "static/%s" (.Get "file") }} +{{ $file := .Get "file" }} {{ $lang := "" }} {{ $suffix := findRE "(\\.[^.]+)$" $file 1 }} {{ with $suffix }} diff --git a/site/layouts/shortcodes/mdwithcopy.html b/site/layouts/shortcodes/codeFromInline.html similarity index 93% rename from site/layouts/shortcodes/mdwithcopy.html rename to site/layouts/shortcodes/codeFromInline.html index 0d4e90f8e9..76859d5dd5 100644 --- a/site/layouts/shortcodes/mdwithcopy.html +++ b/site/layouts/shortcodes/codeFromInline.html @@ -1,4 +1,4 @@ -{{ $code := trim .Inner "\n" }} +{{ $code := trim .Inner "\n" }} {{ $lang := "" }} {{ with .Get "lang" }}{{ $lang = . }}{{ end }} {{ $hash := md5 $code }} diff --git a/site/layouts/shortcodes/minify.html b/site/layouts/shortcodes/minify.html index 44f8fb2714..fa7580f2b2 100644 --- a/site/layouts/shortcodes/minify.html +++ b/site/layouts/shortcodes/minify.html @@ -1,4 +1,4 @@ -{{ $file := printf "static/%s" (.Get "file") }} +{{ $file := .Get "file" }} {{- $contents := readFile $file -}} {{ $res := $contents | resources.FromString $file }} -{{- ($res | resources.Minify).Content -}} +{{- safeHTML (($res | resources.Minify).Content) -}} diff --git a/site/layouts/shortcodes/readFile.html b/site/layouts/shortcodes/readFile.html new file mode 100644 index 0000000000..147b1fa62f --- /dev/null +++ b/site/layouts/shortcodes/readFile.html @@ -0,0 +1,2 @@ +{{/* the one input should be a file path */}} +{{- .Get 0 | readFile | safeHTML -}} \ No newline at end of file