我有一个包含内容的
values.yaml
efslogs:
enables: true
somekey: somevalue`
我有
deployment.yaml
我有条件
env:
- name: SOME_ENV_VAR
value: SOME_VALUE
{{- if .Values.efslogs.enabled }}
- name: EFS_DRIVE_MOUNTES
value: "true"
{{- end}}
我想做的是将 efslogs 块移动到 configmap
efsconfig.efslogs.enabled: true
所以问题是有什么方法可以将此 configmap 引用放入 if 条件中吗?
喜欢
{{- if <referance to my efsconfig.efslogs.enabled> }}
- name: EFS_DRIVE_MOUNTES
value: "true"
{{- end}}
谢谢你
您应该查看 Helm 3.1 中引入的查找功能:
https://helm.sh/docs/chart_template_guide/functions_and_pipelines/#using-the-lookup-function
The lookup function can be used to look up resources in a running cluster. The synopsis of the lookup function is lookup apiVersion, kind, namespace, name -> resource or resource list.