{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ template "teleport-kube-agent.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
{{- if .Values.extraLabels.serviceAccount }}
  labels:
  {{- toYaml .Values.extraLabels.serviceAccount | nindent 4 }}
{{- end }}
{{- if .Values.annotations.serviceAccount }}
  annotations:
{{- toYaml .Values.annotations.serviceAccount | nindent 4 }}
{{- end -}}
{{- end -}}
