apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: minio
  namespace: tailchat
spec:
  selector:
    matchLabels:
      app: minio
  serviceName: minio
  replicas: 1
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
        - name: minio
          image: minio/minio
          imagePullPolicy: IfNotPresent
          env:
            - name: MINIO_ROOT_USER
              value: tailchat
            - name: MINIO_ROOT_PASSWORD
              value: com.msgbyte.tailchat
          command:
            - minio
            - server
            - /data/storage
            - '--console-address'
            - ':9001'
          ports:
            - containerPort: 9000
            - containerPort: 9001
          volumeMounts:
            - name: minio-persistent-storage
              mountPath: /data/tailchat/storage
      volumes:
        - name: minio-persistent-storage
          persistentVolumeClaim:
            claimName: minio-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: minio-service
  namespace: tailchat
spec:
  type: ClusterIP
  selector:
    app: minio
  ports:
    - protocol: TCP
      port: 9000
      targetPort: 9000
