apiVersion: batch/v1
kind: Job
metadata:
  name: minio-init
  namespace: reactbin
spec:
  template:
    spec:
      restartPolicy: OnFailure
      containers:
        - name: mc
          image: minio/mc:latest
          # mc runs as root by default; FR-013 exception documented in spec
          securityContext:
            runAsNonRoot: false
          command:
            - sh
            - -c
            - |
              mc alias set local http://minio:9000 "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD"
              mc mb --ignore-existing local/reactbin
          envFrom:
            - secretRef:
                name: minio-credentials
