apiVersion: apps/v1
kind: StatefulSet
metadata:
  name:  minio
  namespace: edoc2
  labels:
    app: minio
    k8s-app: minio
spec:
  selector:
    matchLabels:
      app: minio
  serviceName: minio
  replicas: 12
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
      - name: minio
        env:
        - name: MINIO_ACCESS_KEY
          value: "admin"
        - name: MINIO_SECRET_KEY
          value: "root123456"
        - name: MINIO_ERASURE_SET_DRIVE_COUNT
          value: "12"
        #- name: MINIO_ERASURE_SET_DATA_SHARDS
        #  value: "8"
        #- name: MINIO_ERASURE_SET_PARITY_SHARDS
        #  value: "4"
        #image: registry.edoc2.com:5000/library/minio:prodv3
        image: registry.edoc2.com:5000/library/minio:prodv3-2023
        #image: minio/minio:latest
        #image: registry.edoc2.com:5001/edoc2v5/minio:2023
        imagePullPolicy: IfNotPresent
        command:
          - /bin/sh
          - -c
          - minio server --console-address ":5000" http://minio-{0...11}.minio.edoc2.svc.cluster.local/data
        ports:
        - name: data
          containerPort: 9000
          protocol: "TCP"
        - name: console
          containerPort: 5000
          protocol: "TCP"
        volumeMounts:
        - name: data
          mountPath: /data
        - name: date-config
          mountPath: /etc/localtime
      volumes:
      - name: date-config
        hostPath:
          path: /usr/share/zoneinfo/Asia/Shanghai
      #- name: data
      #  nfs:
      #    server: 192.168.251.176
      #    path: /data/minio
      nodeSelector:
        "node.dnlabels.nodelabels": DMiddleware
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: [ "ReadWriteMany" ]
      storageClassName: "local-minio-storage"
      resources:
        requests:
          storage: 1000Gi
---
apiVersion: v1
kind: Service
metadata:
  name: minio
  namespace: edoc2
spec:
  #type: LoadBalancer
  type: NodePort
  #type: ClusterIP
  ports:
    - name: data
      port: 9000
      nodePort: 32900
      targetPort: 9000
      protocol: TCP
    - name: console
      port: 5000
      nodePort: 32901
      targetPort: 5000
      protocol: TCP
  selector:
    app: minio
