{{- if and .Values.admin.enabled .Values.admin.secret.adminPassword (not .Values.admin.secret.existingSecret) }}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
  name: {{ include "seaweedfs.fullname" . }}-admin-secret
  namespace: {{ .Release.Namespace }}
  annotations:
    "helm.sh/resource-policy": keep
    "helm.sh/hook": "pre-install,pre-upgrade"
  labels:
    app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/component: admin
data:
  adminUser: {{ .Values.admin.secret.adminUser | b64enc }}
  adminPassword: {{ .Values.admin.secret.adminPassword | b64enc }}
{{- end}}
