apiVersion: batch/v1
kind: Job
#apiVersion: batch/v1beta1
#kind: CronJob
metadata:
  name: noise
spec:
#  schedule: "@daily"
#  concurrencyPolicy: Forbid
#  successfulJobsHistoryLimit: 0
#  failedJobsHistoryLimit: 1
#  jobTemplate:
#    spec:
  template:
    metadata:
      name: noise
    spec:
      containers:
      - name: pipelines
        image: orihoch/sk8s-pipelines
        command:
        - bash
        - "-c"
        - |
          while ! [ -e /pipelines/data/synced ]; do sleep 5 && echo .; done && rm -f /pipelines/data/synced &&\
          dpp run ./noise &&\
          touch /pipelines/data/done
        volumeMounts: [{"name": "data", "mountPath": "/pipelines/data"}]
      - name: ops
        image: orihoch/sk8sops:pipelines-gcs@sha256:c232fcbd4ffff456b9cb9312a4b7d62cec8c0fe6b36bf31e50625a618f129746
        resources: {"requests": {"cpu": "0.01", "memory": "100Mi"}}
        env:
        - name: CLOUDSDK_CORE_PROJECT
          value: uumpa123
        - name: GS_BUCKET_NAME
          value: sk8s-pipelines
        - name: OUTPUT_PATH_PREFIX
          value: tests/
        volumeMounts:
        - name: data
          mountPath: /pipelines/data
        - name: k8s-ops
          mountPath: /k8s-ops
          readOnly: true
      volumes:
      # this is the k8s ops secret, see https://github.com/OriHoch/sk8s-ops/blob/master/README.md#secrets
      - name: k8s-ops
        secret:
          secretName: ops
      # empty dir is stored on host and shared between all container in pod, we use it to sync data between the pods
      - name: data
        emptyDir: {}
      restartPolicy: Never
