{{- $create := true }} {{- if hasKey .Values "serviceAccount" }} {{- $create = (hasKey .Values.serviceAccount "create") | ternary .Values.serviceAccount.create true }} {{- end }} {{- if and .Values.enabled $create }} apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "workflow-worker.serviceAccountName" . }} namespace: {{ include "workflow-worker.namespace" . }} labels: {{- include "workflow-worker.labels" . | nindent 4 }} app.kubernetes.io/component: workflow-worker {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} automountServiceAccountToken: {{ default true .Values.serviceAccount.automountServiceAccountToken }} {{- end }}