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,21 +1,23 @@
{{/* vim: set filetype=mustache: */}}
{{- define "common.service.tpl" -}}
{{- $top := first . -}}
{{- $service := index . 1 -}}
apiVersion: v1
kind: Service
metadata:
{{ include "common.metadata" . | nindent 2 }}
{{ include "common.metadata" (list $top) | nindent 2 }}
spec:
type: {{ .Values.service.type }}
type: {{ $service.type }}
ports:
- port: {{ .Values.service.port }}
- port: {{ $service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "common.selectorLabels" . | nindent 4 }}
{{- include "common.selectorLabels" $top | nindent 4 }}
{{- end -}}
{{- define "common.service" -}}
{{- include "common.utils.flattenCall" (list "common.utils.merge" . "common.service.tpl") -}}
{{- include "common.utils.merge" (append . "common.service.tpl") -}}
{{- end -}}