Skip to content

Commit acaaafc

Browse files
committed
Add note about prefixing variables
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 parent f694414 commit acaaafc

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

docs/spec/v1beta1/kustomization.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,8 @@ kind: Namespace
704704
metadata:
705705
name: apps
706706
labels:
707-
environment: ${env:=dev}
708-
region: "${region}"
707+
environment: ${cluster_env:=dev}
708+
region: "${cluster_region}"
709709
```
710710

711711
You can specify the variables and their values in the Kustomization definition under
@@ -721,18 +721,21 @@ spec:
721721
path: "./apps/"
722722
postBuild:
723723
substitute:
724-
env: "prod"
725-
region: "eu-central-1"
724+
cluster_env: "prod"
725+
cluster_region: "eu-central-1"
726726
````
727727

728+
Note that you should prefix the variables that get replaced by kustomize-controller
729+
to avoid conflicts with any existing scripts embedded in ConfigMaps or container commands.
730+
728731
You can replicate the controller post-build substitutions locally using
729732
[kustomize](https://github.com/kubernetes-sigs/kustomize)
730733
and Drone's [envsubst](https://github.com/drone/envsubst):
731734

732735
```console
733736
$ go install github.com/drone/envsubst/cmd/envsubst
734737
735-
$ export region=eu-central-1
738+
$ export cluster_region=eu-central-1
736739
$ kustomize build ./apps/ | $GOPATH/bin/envsubst
737740
---
738741
apiVersion: v1

0 commit comments

Comments
 (0)