---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mariadb
  namespace: authelia
  labels:
    app: mariadb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mariadb
  template:
    metadata:
      labels:
        app: mariadb
    spec:
      containers:
        - name: mariadb
          image: mariadb:10.4.10
          ports:
            - containerPort: 3306
          env:
            - name: SLAPD_ORGANISATION
              value: MyCompany
            - name: MYSQL_ROOT_PASSWORD
              value: rootpassword
            - name: MYSQL_USER
              value: admin
            - name: MYSQL_PASSWORD
              value: password
            - name: MYSQL_DATABASE
              value: authelia
          volumeMounts:
            - name: data-volume
              mountPath: /var/lib/mysql
      volumes:
        - name: data-volume
          hostPath:
            path: /data/storage/mysql

---
apiVersion: v1
kind: Service
metadata:
  name: mariadb-service
  namespace: authelia
spec:
  selector:
    app: mariadb
  ports:
  - protocol: TCP
    port: 3306
