apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: laravel-cashier
  labels:
    tier: backend
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
      tier: backend
  template:
    metadata:
      labels:
        app: mysql
        tier: backend
    spec:
      containers:
      - name: mysql-server
        image: mysql:5.7.22
        ports:
          - containerPort: 3306
        env:
          - name: MYSQL_USER
            valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: mysql-username
          - name: MYSQL_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: mysql-password
          - name: MYSQL_DATABASE
            valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: database-name
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: root-password
