xray-docs/helm/charts/helm-library/templates/helpers/_lookup.tpl

33 lines
1.3 KiB
Smarty
Raw Normal View History

2025-01-18 10:59:15 +00:00
{{- define "lib.helpers.lookup.env" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- include "lib.error.noKey" (dict "ctx" . "key" "key") -}}
{{- $data := (index .ctx.Values.config.env .key) -}}
{{- if not $data }} {{- /* if[1] */}}
{{- fail (printf "entry %s is not found in env" .key) }}
{{- else -}} {{- /* .if[1] */ -}}
{{ toYaml $data }}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}
{{- define "lib.helpers.lookup.storage" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- include "lib.error.noKey" (dict "ctx" . "key" "key") -}}
{{- $data := (index .ctx.Values.storage .key) -}}
{{- if not $data }} {{- /* if[1] */}}
{{- fail (printf "entry %s is not found in storage" .key) }}
{{- else -}} {{- /* .if[1] */ -}}
{{ toYaml $data }}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}
{{- define "lib.helpers.lookup.service" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- include "lib.error.noKey" (dict "ctx" . "key" "key") -}}
{{- $data := (index .ctx.Values.services .key) -}}
{{- if not $data }} {{- /* if[1] */}}
{{- fail (printf "entry %s is not found in services" .key) }}
{{- else -}} {{- /* .if[1] */ -}}
{{ toYaml $data }}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}