apiVersion: apps/v1
kind: StatefulSet
metadata:
  namespace: xakny
  name: helm-minio
spec:
  serviceName: helm-minio
  replicas: 1
  selector:
    matchLabels:
      app: helm-minio
  template:
    metadata:
      labels:
        app: helm-minio
    spec:
      imagePullSecrets:
        - name: harborsecret
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: minio.node
                    operator: In
                    values:
                      - "true"
      containers:
        - name: minio
          image: 192.168.0.2:8033/cmii/minio:RELEASE.2023-06-02T23-17-26Z
          command: ["/bin/sh", "-c"]
          args:
            - minio server /data --console-address ":9001"
          ports:
            - containerPort: 9000
              name: api
            - containerPort: 9001
              name: console
          env:
            - name: MINIO_ACCESS_KEY
              value: "cmii"
            - name: MINIO_SECRET_KEY
              value: "B#923fC7mk"
          volumeMounts:
            - name: data
              mountPath: /data
          resources:
            limits:
              memory: 2Gi
              cpu: "2"
            requests:
              memory: 200Mi
              cpu: 200m
      volumes:
        - name: data
#          persistentVolumeClaim:
#            claimName: helm-minio
          hostPath:
            path: /var/lib/docker/minio-pv/xakny/

---
apiVersion: v1
kind: Service
metadata:
  name: helm-minio
  namespace: xakny
spec:
  selector:
    app: helm-minio
  ports:
    - name: api
      port: 9000
      targetPort: 9000
      nodePort: 39000
    - name: console
      port: 9001
      targetPort: 9001
      nodePort: 39001
  type: NodePort
