---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: minio
  namespace: database
spec:
  selector:
    matchLabels:
      app: minio
  serviceName: minio-service
  replicas: 1
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
      - name: minio
        image: minio/minio
        env:
        - name: MINIO_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              name: minio-secret
              key: MINIO_ACCESS_KEY
        - name: MINIO_SECRET_KEY
          valueFrom:
            secretKeyRef:
              name: minio-secret
              key: MINIO_SECRET_KEY
        command: ["minio", "server", "/data"]
        ports:
        - name: minio
          containerPort: 9000
        volumeMounts:
        - name: minio-pvc
          mountPath: /data
  volumeClaimTemplates:
  - metadata:
      name: minio-pvc
    spec:
      storageClassName: standard
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 5Gi
      selector:
        matchLabels:
          volume: minio-volume
