如何使用 kustomize configMapGenerator 生成的名称替换 helm values.yaml?

时间:2021-06-12 09:28:08

标签: kubernetes-helm kustomize

我使用 kustomize 生成各种 configMap 作为以下示例:-

# kustomization.yaml

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

输出如下例:-

# 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.

另一方面,我有一个第三方 helm,它需要将 values.yaml 覆盖如下:-

# 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

我们有什么办法可以用名为 my-config-path 的文件中生成的值 third-party-chart-values.yaml 替换 my-config-path-mk89db6928 处的 my-configmap.yaml 吗? (请注意,如果 configMap 更改了散列值,例如 mk89db6928 也会更改。)

0 个答案:

没有答案