apiVersion: batch/v1
kind: Job
metadata:
  name: populate-pvc
  namespace: pvci-test
spec:
  backoffLimit: 1
  activeDeadlineSeconds: 30
  ttlSecondsAfterFinished: 100
  template:
    spec:
      volumes:
        - name: tmp-volume
          emptyDir: {}
        - name: test-rwo-volume
          persistentVolumeClaim:
            claimName: test-rwo
      initContainers:
        - name: mc
          imagePullPolicy: IfNotPresent
          image: minio/mc
          command: ["sh", "-c", "mc cp -r minio/sample/ /tmpdata/"]
          env:
            - name: MC_HOST_minio
              value: "http://private-test:private-test@minio:9000"
          volumeMounts:
            - mountPath: /tmpdata
              name: tmp-volume
      containers:
        - name: cp
          imagePullPolicy: IfNotPresent
          image: minio/mc
          command: ["sh", "-c", "cp -r /tmpdata/* /datavol/"]
          volumeMounts:
            - mountPath: /tmpdata
              name: tmp-volume
            - mountPath: /datavol
              name: test-rwo-volume
      restartPolicy: Never
