Hello,
I'd like to implement immutable ConfigMaps, and the hash suffix feature of configMapGenerator is perfect for that.
However, it seems like it only allows generating ConfigMap key/value pairs from inline literals in kustomization.yaml. The files option just loads an entire file's content as a single key.
I'd really prefer keeping these values in a separate file, so my dev team can edit that without being concerned with kustomization.yaml.
Of course, I could just manage the ConfigMap yaml as a normal resource and not use configMapGenerator, but then I鈥檇 lose the automatic hash suffix feature.
Any ideas ?
@renaudguerin The envs inside ConfigMapGenerator is what you want. It accepts a list of files, each file with k/v pairs.
If you're using Kustomize 2.0.3, it is env and accepts one file.
hello @Liujingfang1 how can we check kustomize version? I get this output from kubectl version:
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"windows/amd64"}
I am able to use env key, but envs key does not work yet.
@cmberryau run kustomize version
I don't have a binary or script for kustomize by itself, using the kubectl -k commands for all kustomize tasks so far on dev machine. Up in Azure I'm using their web based cloud shell, which kustomize returns nothing also.
For the time being I used env (rather than envs) and it works okay.
@cmberryau if you look up the Godeps.json file for the kubernetes/kubernetes commit matching your kubectl version you can see it's v2.0.3: https://github.com/kubernetes/kubernetes/blob/641856db18352033a0d96dbc99153fa3b27298e5/Godeps/Godeps.json#L4400
HTH
@michaelbannister thanks very much for pointing this out!
Most helpful comment
@renaudguerin The
envsinside ConfigMapGenerator is what you want. It accepts a list of files, each file with k/v pairs.If you're using Kustomize 2.0.3, it is
envand accepts one file.