{{- if .Values.api.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kargo-admin
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "kargo.labels" . | nindent 4 }}
  {{- if .Values.api.oidc.admins.claims }}
  annotations:
    {{- range $claim, $values := .Values.api.oidc.admins.claims }}
    rbac.kargo.akuity.io/claim.{{ $claim }}: {{ quote (join "," $values) }}
    {{- end }}
  {{- end }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kargo-viewer
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "kargo.labels" . | nindent 4 }}
  {{- if .Values.api.oidc.viewers.claims }}
  annotations:
    {{- range $claim, $values := .Values.api.oidc.viewers.claims }}
    rbac.kargo.akuity.io/claim.{{ $claim }}: {{ quote (join "," $values) }}
    {{- end }}
  {{- end }}
{{- end }}
