From bcce24e19abaf5388a9cfc32320a0e738595cc50 Mon Sep 17 00:00:00 2001 From: Chi-En Wu Date: Wed, 15 Apr 2020 16:08:30 +0800 Subject: [PATCH] feat: add template `common.serviceAccount` --- templates/_serviceaccount.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 templates/_serviceaccount.yaml diff --git a/templates/_serviceaccount.yaml b/templates/_serviceaccount.yaml new file mode 100644 index 0000000..2837ac8 --- /dev/null +++ b/templates/_serviceaccount.yaml @@ -0,0 +1,26 @@ +{{/* vim: set filetype=mustache: */}} + +{{- define "common.serviceAccount.tpl" -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "common.serviceAccountName" . }} + labels: + {{- include "common.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end -}} + +{{- define "common.serviceAccount.if" -}} +{{- $top := first . -}} +{{- $serviceAccount := $top.Values.serviceAccount | default (dict) -}} +{{- if $serviceAccount.create -}} + {{- include "common.utils.merge" (append . "common.serviceAccount.tpl") -}} +{{- end -}} +{{- end -}} + +{{- define "common.serviceAccount" -}} +{{- include "common.utils.flattenCall" (list "common.serviceAccount.if" .) -}} +{{- end -}}