1

I use kustomize to generate various configMap as the following example: -

# kustomization.yaml

configMapGenerator:
- name: my-config-path # <-- My original name.
  files:
  - file1.txt
  - file2.txt
  - ...
  - fileN.txt

The output is as the following example: -

# my-configmap.yaml

apiVersion: v1
data:
  file1.txt: |
  ...
  file2.txt: |
  ...
  fileN.txt |
  ...
kind: ConfigMap
metadata:
  name: my-config-path-mk89db6928 # <-- There is a hashed value appended at the end.

Oh the other hand, I have a third-party helm which requires to override the values.yaml as the following: -

# third-party-chart-values.yaml

customArguments:
  - --config.dir=/config
...

volumes:
  - mountPath: /config
    name: my-config-path # <--- Here, I would like to replace with `my-config-path-mk89db6928`.
    type: configMap

Do we have any way to replace the my-config-path at the third-party-chart-values.yaml with the generated value my-config-path-mk89db6928 from the file named my-configmap.yaml? (Note, if the configMap is changed the hashed, e.g. mk89db6928 also be changed, too.)

Charlee Chitsuk
  • 8,847
  • 2
  • 56
  • 71

1 Answers1

1

Do you want to keep the hash? Because you could prevent it with:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
generatorOptions:
  disableNameSuffixHash: true

Then you'd have a predictable name. Although that would cause a collision if you installed the same helm chart more than once in the same namespace.

cslauritsen
  • 96
  • 1
  • 5