apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-o11y
  labels:
    app: mysql-o11y
spec:
  selector:
    matchLabels:
      app: mysql-o11y
      tier: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mysql-o11y
        tier: mysql
    spec:
      containers:
      - image: mysql:8.0
        name: mysql
        args:
        - --character-set-server=utf8mb4
        - --collation-server=utf8mb4_unicode_ci
        - --default-authentication-plugin=mysql_native_password
        env:
        - name: MYSQL_USER
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: username
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: root_password
        - name: MYSQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: password
        - name: MYSQL_DATABASE
          value: dreamkast
        ports:
        - containerPort: 3306
          name: mysql
