{{- if and .Values.supervisor.enabled .Values.supervisor.deployAPIService }}
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
  name: v1alpha1.clientsecret.supervisor.pinniped.dev
  namespace: {{ include "common.names.namespace" . | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/part-of: pinniped
    app.kubernetes.io/component: supervisor
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations:
    {{- if .Values.commonAnnotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
  {{- end }}
spec:
  version: v1alpha1
  group: clientsecret.supervisor.pinniped.dev
  groupPriorityMinimum: 9900
  versionPriority: 15
  service:
    name: {{ template "pinniped.supervisor.api.fullname" . }}
    namespace: {{ template "common.names.namespace" . }}
    port: 443
{{- end }}
