apiVersion: batch/v1
kind: Job
metadata:
  name: dw-cog-uploader
  namespace: geocrop
spec:
  template:
    spec:
      restartPolicy: OnFailure
      containers:
      - name: uploader
        image: minio/mc
        command: ["/bin/sh", "-c"]
        args:
          - |
            mc alias set local http://minio:9000 minioadmin minioadmin123
            
            # Upload from /data/upload directory
            mc mirror --overwrite /data/upload local/geocrop-baselines/
            
            echo "Upload complete - counting files:"
            mc ls local/geocrop-baselines/ --recursive | wc -l
        volumeMounts:
        - name: upload-data
          mountPath: /data/upload
      volumes:
      - name: upload-data
        emptyDir: {}
