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