apiVersion: apps/v1
kind: Deployment
metadata:
  name: minio-deployment
spec:
  selector:
    matchLabels:
      app: minio
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: minio
    spec:
      volumes:
      - name: storage
        persistentVolumeClaim:
          claimName: minio
      containers:
      - name: minio
        # image: minio/minio:latest
        image: quay.io/minio/minio:RELEASE.2021-12-20T22-07-16Z
        # TODO: tls certs for minio console
        env:
        - name: MINIO_ROOT_USER
          valueFrom:
            secretKeyRef:
              name: minio-root
              key: user
        - name: MINIO_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: minio-root
              key: password
        - name: MINIO_REGION_NAME
          value: "eu-central-1"
        command: 
        - "/bin/sh"
        - "-ce"
        - "/usr/bin/docker-entrypoint.sh minio server /storage -S /etc/minio/certs/ --address :9000 --console-address :9001"
        # - "minio server /storage --console-address :9001"
        ports:
        - name: api
          containerPort: 9000
        - name: console
          containerPort: 9001
        volumeMounts:
        - name: storage # must match the volume name, above
          mountPath: "/storage"