apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-deployment
  labels:
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - name: mysql
        # image: docker.io/library/mysql:5.7.36@sha256:7a3a7b7a29e6fbff433c339fc52245435fa2c308586481f2f92ab1df239d6a29
        image: registry.redhat.io/rhel8/mysql-80
        # command: 
          # - '/usr/sbin/mkdir /var/lib/mysql &&'
          # - 'mysqld'
        # args:
          # - '--character-set-server=utf8mb4'
          # - '--collation-server=utf8mb4_unicode_ci'
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql
              key: MYSQL_ROOT_PASSWORD
        - name: MYSQL_USER
          valueFrom:
            secretKeyRef:
              name: mysql
              key: MYSQL_USER
        - name: MYSQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql
              key: MYSQL_PASSWORD
        - name: MYSQL_DATABASE
          valueFrom:
            secretKeyRef:
              name: mysql
              key: MYSQL_DATABASE
        ports:
        - containerPort: 3306
        resources:
          requests:
            memory: "1Gi"
            cpu: "250m"
          limits:
            memory: "4Gi"
            cpu: "1"
        volumeMounts:
        - name: defectdojo-data
          mountPath: /var/lib/mysql
      volumes:
      - name: defectdojo-data
        persistentVolumeClaim:
          claimName: mysql-data
