{{- if .Values.webhook.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
automountServiceAccountToken: {{ .Values.webhook.serviceAccount.automountServiceAccountToken }}
metadata:
  labels:
    app.kubernetes.io/component: webhook
  {{- include "common.labels.standard" . | nindent 4 }}
  name: {{ template "certmanager.webhook.serviceAccountName" . }}
  {{- $mergedAnnotations := merge .Values.webhook.serviceAccount.annotations .Values.commonAnnotations }}
  {{- if $mergedAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" $mergedAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
  namespace: {{ .Release.Namespace | quote }}
{{- end }}
