{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "ark.fullname" . }}
  labels:
    app: {{ template "ark.name" . }}
    chart: {{ template "ark.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
type: Opaque
data:
{{- range $key, $value := .Values.credentials.secretContents }}
  {{ $key }}: {{ $value | b64enc | quote }}
{{- end }}
{{- end -}}
