feat: add template common.serviceAccount
This commit is contained in:
26
templates/_serviceaccount.yaml
Normal file
26
templates/_serviceaccount.yaml
Normal file
@ -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 -}}
|
Reference in New Issue
Block a user