apiVersion: v1
kind: Secret
metadata:
  name: {{ template "lamp.fullname" . }}
  labels:
    app: {{ template "lamp.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  {{- if .Values.keepSecrets }}
  annotations:
    helm.sh/resource-policy: keep
  {{- end }}
type: Opaque
data:
  {{- if .Values.mysql.rootPassword }}
  mysql-root-password: {{ .Values.mysql.rootPassword | b64enc | quote }}
  {{- if and .Values.mysql.user .Values.mysql.password }}
  mysql-user: {{ .Values.mysql.user | b64enc | quote }}
  mysql-password: {{ .Values.mysql.password | b64enc | quote }}
  {{- if .Values.mysql.database}}
  mysql-database: {{ .Values.mysql.database | b64enc | quote }}
  {{- end }}
  {{- end }}
  {{- end }}
  {{- if .Values.wordpress.gdriveRToken }}
  gdrive-rtoken: {{ .Values.wordpress.gdriveRToken | b64enc | quote }}
  {{- end }}
  {{- if .Values.ingress.htpasswdString }}
  auth: {{ .Values.ingress.htpasswdString | b64enc | quote }}
  {{- end }}
  {{- if .Values.sftp.enabled }}
  sftp-user: {{ required "Please specify the SFTP user name at .Values.sftp.user" .Values.sftp.user | b64enc | quote }}
  sftp-password: {{ required "Please specify the SFTP user password at .Values.sftp.password" .Values.sftp.password | b64enc | quote }}
  {{- end }}
  {{- if .Values.svn.enabled }}
  svn-user: {{ required "Please specify the SVN user name at .Values.svn.user" .Values.svn.user | b64enc | quote }}
  svn-password: {{ required "Please specify the SVN user password at .Values.svn.password" .Values.svn.password | b64enc | quote }}
  {{- end }}
  {{- if .Values.webdav.enabled }}
  webdav-user: {{ required "Please specify the WebDAV user name at .Values.webdav.user" .Values.webdav.user | b64enc | quote }}
  webdav-password: {{ required "Please specify the WebDAV user password at .Values.webdav.password" .Values.webdav.password | b64enc | quote }}
  {{- end }}
