I have kustomize deployment which installs helm chart. This helm chart expects particular config map to exist and be mounted into pod. configMapGenerator component generates config maps with hash suffix.
I.e. following kustomize section:
configMapGenerator:
- name: my-config-map
files:
- my-file.json
Will generate config map with name my-config-map-fdt4f87bkm. I want to pass this config map to helm chart in HelmRelease:
values:
configmap: my-config-map
However this does not work, becasue real name of config map is my-config-map-fdt4f87bkm.
I want to keep using configMapGenerator to ensure that pods are rolled when there is conifguration change.
How I can pass real name of config map there?
You have two ways. Either turn off suffix hash like:
or use kustomizeconfig.
(I'm considering by
HelmReleaseYou mean FluxCD HelmRelease object and You provide values to it by.spec.valuesFromnot.spec.values)for kustomize configuration, You have to provide a file with this content:
this file makes kustomize to append configMap suffixes to referenced configMaps for helm release values. now set your
kustomization.yamlto use this file:Output of
kustomize buildusing kustomizeconfig file: