apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2, before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
  name: rathena-mysql
  labels:
    app: rathena
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rathena
      component: mysql
      version: v1.0
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: rathena
        component: mysql
        version: v1.0
    spec:
      containers:
      - image: mysql:5.7
        name: mysql
        args:
        - "--ignore-db-dir=lost+found"
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pwd
              key: password
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: rathena-mysql-persistent-storage
          mountPath: /var/lib/mysql
        resources:
          requests:
            memory: "1024Mi"
            cpu: "1"
          limits:
            memory: "4096Mi"
            cpu: "4"
      volumes:
      - name: rathena-mysql-persistent-storage
        persistentVolumeClaim:
          claimName: rathena-mysql-pv-claim