feat: allow arguments to be passed to templates

This commit is contained in:
Chi-En Wu
2020-04-22 10:26:17 +08:00
parent bddaab6942
commit 9aecdacf39
15 changed files with 137 additions and 143 deletions

View File

@ -1,10 +1,12 @@
{{/* vim: set filetype=mustache: */}}
{{- define "common.serviceMonitor.secret.tpl" -}}
{{- $basicAuth := .Values.serviceMonitor.basicAuth | default (dict) -}}
{{- $top := first . -}}
{{- $serviceMonitor := index . 1 -}}
{{- $basicAuth := $serviceMonitor.basicAuth | default (dict) -}}
metadata:
name: {{ $basicAuth.secretName | default (include "common.fullname" .) }}
{{- with .Values.serviceMonitor.namespace }}
name: {{ $basicAuth.secretName | default (include "common.fullname" $top) }}
{{- with $serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
{{- if $basicAuth.enabled }}
@ -14,14 +16,10 @@ data:
{{- end }}
{{- end -}}
{{- define "common.serviceMonitor.secret.if" -}}
{{- define "common.serviceMonitor.secret" -}}
{{- $top := first . -}}
{{- $serviceMonitor := $top.Values.serviceMonitor | default (dict) -}}
{{- $serviceMonitor := index . 1 -}}
{{- if $serviceMonitor.enabled -}}
{{- include "common.secret" (append . "common.serviceMonitor.secret.tpl") -}}
{{- end -}}
{{- end -}}
{{- define "common.serviceMonitor.secret" -}}
{{- include "common.utils.flattenCall" (list "common.serviceMonitor.secret.if" .) -}}
{{- end -}}