apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: auto-deploy-master
  clusterName: kubeflow-testing
  namespace: kubeflow-test-infra
spec:
  concurrencyPolicy: Forbid
  schedule: 0 */12 * * *
  jobTemplate:
    spec:
      backoffLimit: 2
      template:
        spec:
          initContainers:
          - command:        
            - /usr/local/bin/checkout_repos.sh 
            - --repos=kubeflow/kfctl@HEAD,kubeflow/testing@HEAD
            - --src_dir=/src
            env:
            - name: PYTHONPATH
              value: /src/kubeflow/testing/py
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /secret/gcp-credentials/key.json
            image: gcr.io/kubeflow-ci/test-worker@sha256:dd559f89b3cbd926ec563559995f25025eecc6290b3146f17f82d2f084d07ee2
            imagePullPolicy: IfNotPresent
            name: checkout
            resources: {}
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /secret/gcp-credentials
              name: gcp-credentials
              readOnly: true
            - mountPath: /src
              name: src
          containers:
          - name: deploy
            image: gcr.io/kubeflow-ci/test-worker@sha256:dd559f89b3cbd926ec563559995f25025eecc6290b3146f17f82d2f084d07ee2
            env:
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /secret/gcp-credentials/key.json
            - name: PYTHONPATH
              value: /src/kubeflow/testing/py
            command:
            - python
            - -m
            - kubeflow.testing.create_unique_kf_instance
            - --apps_dir=/src/apps
            - --kubeflow_repo=/src/kubeflow/kfctl
            - --name=kf-vmaster-{uid}
            - --project=kubeflow-ci-deployment
            - --zone=us-central1-a
            - --kfctl_config=https://raw.githubusercontent.com/kubeflow/manifests/master/kfdef/kfctl_gcp_iap.yaml
            volumeMounts:
            - name: gcp-credentials
              mountPath: /secret/gcp-credentials
              readOnly: true
            - mountPath: /src
              name: src
          restartPolicy: Never
          volumes:
          - name: gcp-credentials
            secret:
              secretName: gcp-credentials
          - name: src
            emptyDir: {}