apiVersion: batch/v1
kind: Job
metadata:
  name: "{will_be_replace}"
  namespace: apps-mlflow
spec:
  ttlSecondsAfterFinished: 100
  backoffLimit: 0
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      tolerations:
      - key: "dedicated"
        operator: Equal
        value: "ml"
      initContainers:
      - name: create-tubes-directory
        image: 'alpine:3.7'
        args: ["mkdir", "-p", "/workspace/xebikart-ml-tubes"]
        volumeMounts:
        - name: workspace
          mountPath: /workspace
      - name: download-tubes
        image: 'google/cloud-sdk:alpine'
        command: ["gsutil", "-m"]
        args: ["cp", "gs://xebikart-dataset/*.tar.gz", "xebikart-ml-tubes"]
        workingDir: /workspace
        volumeMounts:
        - name: workspace
          mountPath: /workspace
      containers:
      - name: "{will_be_replace}"
        image: "{will_be_replace}"
        command: ["{will_be_replace}"]
        env:
          - name: "GOOGLE_APPLICATION_CREDENTIALS"
            value: "/var/run/secret/cloud.google.com/service-account.json"
        volumeMounts:
        - name: workspace
          mountPath: /workspace
        - name: "service-account"
          mountPath: "/var/run/secret/cloud.google.com"
        resources:
          requests:
            cpu: 3000m
            memory: 8000Mi
      restartPolicy: Never
      volumes:
      - name: workspace
        emptyDir: {}
      - name: "service-account"
        secret:
          secretName: "apps-sa-key"