apiVersion: k8s.mariadb.com/v1alpha1
kind: Connection
metadata:
  name: {{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
spec:
  mariaDbRef:
    name: mariadb
    namespace: default
  username: {{ .Values.db.username | quote }}
  passwordSecretKeyRef:
    name: "{{ .Release.Name }}-db-pass"
    key: password
  database: {{ .Values.db.name | quote }}
  secretName: "{{ .Release.Name }}-db-connection"
  secretTemplate:
    key: dsn
    usernameKey: DB_USER
    passwordKey: DB_PASSWORD
    hostKey: DB_HOST
    portKey: DB_PORT
    databaseKey: DB_NAME
  healthCheck:
    interval: 60s
    retryInterval: 30s
  serviceName: mariadb
