Skip to content

Commit

Permalink
docs(readme): Kubernetes example wording
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 29, 2024
1 parent ba2d013 commit 671ffd9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Also, see [templating](#templating) and [example](#examples) sections.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
name: nginx
spec:
selector:
matchLabels:
Expand All @@ -177,24 +177,24 @@ Also, see [templating](#templating) and [example](#examples) sections.
spec:
containers:
- name: nginx
image: nginx:1.20.2 #yampl nginx:{{ .tag }}
image: nginx:1.26.1 #yampl nginx:{{ .tag }}
ports:
- containerPort: 80
```

Notice the yaml comment on the same line as `image`.

If this file was called `nginx.yaml`, then we could replace the image tag by running:
If this file was called `nginx.yaml`, then you could replace the image tag by running:
```shell
yampl -i nginx.yaml -v tag=1.21.6
yampl -i nginx.yaml -v tag=1.27.0
```

The file would be updated in-place:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
name: nginx
spec:
selector:
matchLabels:
Expand All @@ -206,18 +206,18 @@ Also, see [templating](#templating) and [example](#examples) sections.
spec:
containers:
- name: nginx
image: nginx:1.21.6 #yampl nginx:{{ .tag }}
image: nginx:1.27.0 #yampl nginx:{{ .tag }}
ports:
- containerPort: 80
```

If I wanted to repeat myself even less, I could utilize the `repo` function to pull the existing repo through.
I could define the `image` template as:
If you wanted to repeat yourself even less, you could use the [`repo`](#repo) function to pull the existing repo through to the output.
For example, you could change the `image` line to:
```yaml
image: nginx:1.21.6 #yampl {{ repo current }}:{{ .tag }}
image: nginx:1.27.0 #yampl {{ repo current }}:{{ .tag }}
```

This would generate the same output, but I didn't have to type `nginx` twice.
This would generate the same output, but you wouldn't have to type `nginx` twice.
This becomes more useful when using custom Docker registries where repo names can get long.
</details>
Expand Down

0 comments on commit 671ffd9

Please sign in to comment.