{{- if not .Values.jwtSecret.existingSecret }}
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace (include "datastore.lfsJwtSecret.secretName" . )) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "datastore.lfsJwtSecret.secretName" . }}
type: Opaque
data:
  {{- if .Values.jwtSecret.value }}
  jwtSecret: {{ .Values.jwtSecret.value | b64enc | quote -}}
  {{- else if $existingSecret }}
  jwtSecret: {{ index $existingSecret.data "jwtSecret" }}
  {{- else }}
  jwtSecret: {{ (include "datastore.lfsJwtSecret.random" .) | b64enc | quote -}}
  {{- end }}
{{- end }}
