apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: minio
    release: minio
    kots.io/backup-type: admin-console
  name: minio
spec:
  serviceName: minio
  selector:
    matchLabels:
      app: minio
      release: minio
  template:
    metadata:
      labels:
        app: minio
        release: minio
        kots.io/backup-type: admin-console
      annotations:
        backup.velero.io/backup-volumes: miniodata
        kots.io/backup-type: admin-console  
      name: minio
    spec:
      securityContext:
        runAsUser: 1001
        fsGroup: 1001
      containers:
      - args:
          - server
          - /data
        env:
        - name: MINIO_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              key: accesskey
              name: minio
        - name: MINIO_SECRET_KEY
          valueFrom:
            secretKeyRef:
              key: secretkey
              name: minio
        - name: MINIO_BROWSER
          value: "on"
        image: kotsadm/minio:alpha
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /minio/health/live
            port: service
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 1
        name: minio
        ports:
          - containerPort: 9000
            name: service
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /minio/health/ready
            port: service
          initialDelaySeconds: 5
          periodSeconds: 15
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          requests:
            cpu: 250m
            memory: 256Mi
        volumeMounts:
          - mountPath: /data
            name: miniodata  # this is where the data is stored

  volumeClaimTemplates:
  - metadata:
      name: miniodata
    spec:
      accessModes:
      - "ReadWriteOnce"
      resources:
        requests:
          storage: 2Gi
