apiVersion: v1
kind: Service
metadata:
  name: chaos-minio
  labels:
    app: chaos-minio
spec:
  ports:
    - name: port-minio # note the name is no more than 15 characters
      port: 9000
      targetPort: 9000
  selector:
    app: chaos-minio

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: chaos-minio
  labels:
    app: chaos-minio
spec:
  selector:
    matchLabels:
      app: chaos-minio
  serviceName: chaos-minio
  replicas: 1
  template:
    metadata:
      labels:
        app: chaos-minio
    spec:
      containers:
      - name: minio
        image: minio/minio:latest
        imagePullPolicy: IfNotPresent
        env:
          - name: MINIO_ACCESS_KEY
            value: "engine"
          - name: MINIO_SECRET_KEY
            value: "engineSecret"
        args:
          - server
          - /data
        ports:
          - containerPort: 9000
            hostPort: 9000
        # These volume mounts are persistent. Each pod in the StatefulSet
        # gets a volume mounted based on this field.
        volumeMounts:
          - name: data
            mountPath: /data
        livenessProbe:
            exec:
              command:
                - "curl"
                - "-f"
                - "http://localhost:9000/minio/health/live"
            initialDelaySeconds: 3
            periodSeconds: 10
            timeoutSeconds: 60
  # These are converted to volume claims by the controller
  # and mounted at the paths mentioned above.
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
