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,33 +1,35 @@
{{/* vim: set filetype=mustache: */}}
{{- define "common.pod-template.tpl" -}}
{{- $top := first . -}}
{{- $values := index . 1 -}}
metadata:
labels:
{{- include "common.selectorLabels" . | nindent 4 }}
{{- include "common.selectorLabels" $top | nindent 4 }}
spec:
{{- with .Values.imagePullSecrets }}
{{- with $values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "common.serviceAccountName" . }}
serviceAccountName: {{ include "common.serviceAccountName" $top }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 4 }}
{{- toYaml $values.podSecurityContext | nindent 4 }}
containers:
- {{- include "common.container" . | nindent 6 }}
{{- with .Values.nodeSelector }}
{{- with $values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.affinity }}
{{- with $values.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tolerations }}
{{- with $values.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
{{- define "common.pod-template" -}}
{{- include "common.utils.flattenCall" (list "common.utils.merge" . "common.pod-template.tpl") -}}
{{- include "common.utils.merge" (append . "common.pod-template.tpl") -}}
{{- end -}}