{{ if or .Values.config.enableWebUI .Values.certificate }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "secretName" . }}
  labels: {{ include "common.labels" . | nindent 4 }}
type: Opaque
data:
  {{ if .Values.config.enableWebUI }}
  username: {{ .Values.config.username | b64enc | quote }}
  password: {{ .Values.config.password | b64enc | quote }}
  {{ end }}
  {{ if .Values.certificate }}
    {{ if eq (include "certAvailable" .) "true" }}
  certPublicKey: {{ (include "cert.publicKey" .) | toString | b64enc | quote }}
  certPrivateKey: {{ (include "cert.privateKey" .) | toString | b64enc | quote }}
    {{ else }}
      {{ fail "No certificate configured for Collabora" }}
    {{ end }}
  {{ end }}
{{ end }}
