Skip to content

Commit

Permalink
Camelcase shortcodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
amwat committed Dec 13, 2019
1 parent 0f4b43f commit 8e772d9
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion site/content/docs/user/configuration.md
Expand Up @@ -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" >}}

36 changes: 22 additions & 14 deletions site/content/docs/user/ingress.md
Expand Up @@ -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 <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
Expand All @@ -51,21 +51,27 @@ nodes:
- containerPort: 443
hostPort: 443
EOF
```
{{< /codeFromInline >}}

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.
Expand All @@ -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 >}}
2 changes: 1 addition & 1 deletion site/content/docs/user/local-registry.md
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/user/private-registries.md
Expand Up @@ -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

Expand Down
@@ -1,2 +1,2 @@
{{/* the one input should be a relative url */}}
{{- .Get 0 | absURL }}
{{- .Get 0 | absURL }}
@@ -1,4 +1,4 @@
{{ $file := printf "static/%s" (.Get "file") }}
{{ $file := .Get "file" }}
{{ $lang := "" }}
{{ $suffix := findRE "(\\.[^.]+)$" $file 1 }}
{{ with $suffix }}
Expand Down
@@ -1,4 +1,4 @@
{{ $code := trim .Inner "\n" }}
{{ $code := trim .Inner "\n" }}
{{ $lang := "" }}
{{ with .Get "lang" }}{{ $lang = . }}{{ end }}
{{ $hash := md5 $code }}
Expand Down
4 changes: 2 additions & 2 deletions 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) -}}
2 changes: 2 additions & 0 deletions site/layouts/shortcodes/readFile.html
@@ -0,0 +1,2 @@
{{/* the one input should be a file path */}}
{{- .Get 0 | readFile | safeHTML -}}

0 comments on commit 8e772d9

Please sign in to comment.