apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: mysql
  name: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        io.kompose.service: mysql
    spec:
      containers:
        - env:
            - name: MYSQL_DATABASE
              valueFrom:
                configMapKeyRef:
                  key: MYSQL_DATABASE
                  name: todo-web-application-config
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: RDS_PASSWORD
                  name: todo-web-application-secrets
            - name: MYSQL_ROOT_PASSWORD
              value: dummypassword
            - name: MYSQL_USER
              valueFrom:
                configMapKeyRef:
                  key: MYSQL_USER
                  name: todo-web-application-config
          image: mysql:5.7
          args:
          - "--ignore-db-dir=lost+found" #CHANGE
          name: mysql
          ports:
            - containerPort: 3306
          volumeMounts:
            - mountPath: /var/lib/mysql
              name: mysql-database-data-volume
      restartPolicy: Always
      volumes:
        - name: mysql-database-data-volume
          persistentVolumeClaim:
            claimName: mysql-database-data-volume

