{{- if .Values.updater.enabled }}
{{- if .Values.updater.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "vertical-pod-autoscaler.updater.serviceAccountName" . }}
  labels:
    {{- include "vertical-pod-autoscaler.updater.labels" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if or .Values.updater.serviceAccount.annotations .Values.commonAnnotations }}
  annotations:
    {{- if .Values.updater.serviceAccount.annotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.updater.serviceAccount.annotations "context" $ ) | nindent 4 }}
    {{- end }}
    {{- if .Values.commonAnnotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
  {{- end }}
{{- end -}}
{{- end -}}
