apiVersion: v1
kind: Service
metadata:
  name: collabora-mysql
  namespace: collabora
  labels:
    app: collabora
spec:
  ports:
    - port: 3306
  selector:
    app: collabora
    tier: mysql
  clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: collabora-mysql
  namespace: collabora
  labels:
    app: collabora
spec:
  selector:
    matchLabels:
      app: collabora
      tier: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: collabora
        tier: mysql
    spec:
      containers:
      - image: mysql:latest
        name: mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: collabora-secrets
              key: db_password
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: collabora-pv-claim
