apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: minio
  namespace: minio
  labels:
    app.kubernetes.io/name: minio
    app.kubernetes.io/env: development
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: minio
      app.kubernetes.io/env: development
  serviceName: minio-service
  replicas: 1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: minio
        app.kubernetes.io/env: development
    spec:
      terminationGracePeriodSeconds: 30
      restartPolicy: Always
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: workloads
                operator: In
                values:
                - enabled
      containers:
      - name: minio
        image: minio/minio:RELEASE.2021-11-03T03-36-36Z
        args:
        - server
        - --console-address
        - :9001
        - /data
        imagePullPolicy: IfNotPresent
        env:
        - name:  MINIO_ROOT_USER
          value: "AKIAIOSFODNN7EXAMPLE"
        - name:  MINIO_ROOT_PASSWORD
          value: "tmhOKAF3YriPkHpCbvz1HhRxRfJiAjtqOlUk2kkC"
        - name: MINIO_REGION_NAME
          value: "minio"
        - name: MINIO_PROMETHEUS_AUTH_TYPE
          value: "public"
        ports:
        - name: api
          containerPort: 9000
          protocol: TCP
        - name: console
          containerPort: 9001
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /minio/health/live
            port: 9000
            scheme: HTTP
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 10
          successThreshold: 1
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /minio/health/ready
            port: 9000
            scheme: HTTP
          initialDelaySeconds: 20
          periodSeconds: 15
          timeoutSeconds: 10
          successThreshold: 1
          failureThreshold: 3
        resources:
          requests:
            memory: 256Mi
            cpu: 100m
          limits:
            memory: 512Mi
            cpu: 200m
        volumeMounts:
        - name: minio-volume
          mountPath: /data
  volumeClaimTemplates:
  - metadata:
      name: minio-volume
    spec:
      storageClassName: standard
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
