apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
  name: "{{ .Release.Name }}-db-pass"
  namespace: {{ .Release.Namespace }}
  annotations:
    sealedsecrets.bitnami.com/cluster-wide: "true"
spec:
  encryptedData:
    password: {{ .Values.db.sealedPassword | quote }}
  template:
    metadata:
      annotations:
        sealedsecrets.bitnami.com/cluster-wide: "true"
      name: "{{ .Release.Name }}-db-pass"
      namespace: {{ .Release.Namespace }}
---
apiVersion: k8s.mariadb.com/v1alpha1
kind: User
metadata:
  name: "{{ .Release.Name }}-db-user"
spec:
  name: {{ .Values.db.username | quote }}
  mariaDbRef:
    name: mariadb
    namespace: default
  passwordSecretKeyRef:
    name: "{{ .Release.Name }}-db-pass"
    key: password
  # This field is immutable and defaults to 10
  host: "%"
  cleanupPolicy: Delete
  maxUserConnections: 0
