{{ if .Values.admin.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "powerdns.fullname" . }}-admin-secret
  labels:
{{ include "powerdns.labels" . | indent 4}}
    release: {{ .Release.Name }}
    chart: {{ template "powerdns.chart" . }}
type: Opaque
data:
  PDNS_APIKEY: {{ required "Missing value: apikey" .Values.apikey | b64enc }}
  MYSQL_PASS: {{ required "Missing value: mariadb.mysql_pass" .Values.mariadb.mysql_pass | b64enc }}
  {{ if .Values.mariadb.mysql_rootpass }}
  MYSQL_ROOTPASS: {{ .Values.mariadb.mysql_rootpass | b64enc }}
  {{ end }}
  PDNSADMIN_SECRET: {{ required "Missing value: .admin.secret" .Values.admin.secret | b64enc }}
{{ end }}
