{{- if and .Values.contour.certgen.serviceAccount.create (include "contour.contour-certgen.enabled" .) }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "contour.contourCertGenServiceAccountName" . }}
  namespace: {{ .Release.Namespace }}
  annotations:
    "helm.sh/hook": "pre-install,pre-upgrade"
    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
    {{- if .Values.commonAnnotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: contour-certgen
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
{{- end }}
