{{- if and .Values.notary.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "harbor.notary-server" . }}
  labels:
{{ include "harbor.labels" . | indent 4 }}
    component: notary
type: Opaque
data:
  {{- if not .Values.notary.secretName }}
  {{- $ca := genCA "harbor-notary-ca" 3650 }}
  {{- $cert := genSignedCert (include "harbor.notary-signer" .) nil nil 3650 $ca }}
  ca.crt: {{ $ca.Cert | b64enc | quote }}
  tls.crt: {{ $cert.Cert | b64enc | quote }}
  tls.key: {{ $cert.Key | b64enc | quote }}
  {{- end }}
  server.json: {{ tpl (.Files.Get "conf/notary-server.json") . | b64enc }}
  signer.json: {{ tpl (.Files.Get "conf/notary-signer.json") . | b64enc }}
{{- end }}
