Kubernetes 如何根据舵图中的参数动态获取值

Kubernetes 如何根据舵图中的参数动态获取值,kubernetes,kubernetes-helm,Kubernetes,Kubernetes Helm,我创建了Helm图表帮助文件,如下所示: {{- define "logging.log_path" -}} {{- if and .Values.log_path (eq .Values.app_type "sales") }} {{- join "," .Values.log_path.sales }} {{ else if and .Values.log_path (eq .Values.app_type "invent

我创建了Helm图表帮助文件,如下所示:

{{- define "logging.log_path" -}}
{{- if and .Values.log_path (eq .Values.app_type "sales") }}
{{- join "," .Values.log_path.sales }}
{{ else if and .Values.log_path (eq .Values.app_type "inventory") }}
{{- join "," .Values.log_path.inventory }}
{{ else if and .Values.log_path (eq .Values.app_type "order") }}
{{- join "," .Values.log_path.order }}
{{ else if and .Values.log_path (eq .Values.app_type "warehouse") }}
{{- join "," .Values.log_path.warehouse }}
{{ else }}
{{- join "," .Values.log_path.sales }}
{{- end }}
{{- end }}
问题是每当需要添加新的
app\u type
时,我都需要手动在该文件中添加
app\u type
。我认为它很难维护,也很耗时

我是否可以这样做
.Values.log\u path[“.Values.app\u type”]
或任何类似的解决方案?谢谢。

头盔包括一个

获取$myDict“key1”

{{ define "logging.log_path" }}
{{- $path := get .Values.log_path .Values.app_type | default .Values.log_path.sales -}}
{{- join "," $path -}}
{{ end }}