apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  labels:
    app: mysql
    visualize: "true"
    type: workshop
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
      version: "5.6"
  template:
    metadata:
      labels:
        app: mysql
        version: "5.6"
        visualize: "true"
      annotations:
        sidecar.istio.io/inject: 'true'
    spec:
      containers:
      - name: mysql
        image: mysql:5.6
        imagePullPolicy: Always
        livenessProbe:
          tcpSocket:
            port: 3306
        env:
        - name: MYSQL_ROOT_PASSWORD
          # change this
          value: yourpassword
        - name: MYSQL_DATABASE
          value: app
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
          # name must match the volume name below
        - name: mysql-persistent-storage
          # mount path within the container
          mountPath: /var/lib/mysql
        resources:
          requests:
            cpu: 400m
            memory: 500Mi
          limits:
            cpu: 800m
            memory: 2000Mi
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-pvc
