apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - name: mysql
          image: mysql:8
          env:
            - name: MYSQL_DATABASE
              value: data
          envFrom:
            - secretRef:
                name: mysql
#          resources:
#            requests:
#              cpu: "1"
#              memory: "2Gi"
#            limits:
#              cpu: "2"
#              memory: "4Gi"
          volumeMounts:
            - mountPath: /etc/mysql/conf.d
              name: mysql-config
            - mountPath: /var/lib/mysql
              name: mysql
      # nodeSelector:
      #   node_store_type: mysql
      restartPolicy: Always
      volumes:
        - name: mysql-config
          configMap:
            name: mysql
            items:
              - key: mysql-custom.cnf
                path: mysql-custom.cnf
        - name: mysql
          hostPath:
            path: /var/k8s/volumes/default/mysql
