apiVersion: v1
data:
  deploy-kubeflow.yaml: |
    # This version of the script has been updated to use unique names
    # See https://github.com/kubeflow/testing/issues/444
    # Its also using an init container to check out the code.
    apiVersion: batch/v1
    kind: Job
    metadata:
      generateName: deploy-master-
      labels:
        job: deploy-master-oneoff
        version: master
    spec:
      backoffLimit: 1
      template:
        metadata:
          annotations:
            # side cars can cause jobs to get stuck.
            sidecar.istio.io/inject: "false"
          labels:
            job: deploy-master-oneoff
            version: master
        spec:
          initContainers:
          - command:
            - /usr/local/bin/checkout_repos.sh
            # TOODO(jlewi): We should really switch to tekton and use resources.
            # TODO(https://github.com/kubeflow/testing/pull/641): Switch to  kubeflow/testing@HEAD
            # after 641 is merged
            - --depth=all
            - --repos=kubeflow/kfctl@HEAD,jlewi/testing@playbook
            - --src_dir=/src
            - --links
            env:
            - name: PYTHONPATH
              value: /src/kubeflow/testing/py
            image: gcr.io/kubeflow-ci/test-worker@sha256:dd559f89b3cbd926ec563559995f25025eecc6290b3146f17f82d2f084d07ee2
            imagePullPolicy: IfNotPresent
            name: checkout
            resources: {}
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /src
              name: src
          containers:
          - name: deploy
            image: gcr.io/kubeflow-ci/test-worker@sha256:dd559f89b3cbd926ec563559995f25025eecc6290b3146f17f82d2f084d07ee2
            env:
            # TODO(jlewi): Get rid of /src/jlewi once we change repos to checkout kubeflow/testing
            - name: PYTHONPATH
              value: /src/kubeflow/testing/py:/src/jlewi/testing/py
            # We need to explicitly set the KUBECONFIG variable because that's what our python client uses to determine
            # whether its an in cluster config or not.
            - name: KUBECONFIG
              value: /etc/.kube
            # Note command is completely overwritten by reconciler
            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
            - --no-use_self-cert
            volumeMounts:
            - mountPath: /src
              name: src
          # Rely on workload identity.
          serviceAccount: default-editor
          restartPolicy: Never
          volumes:
          - name: src
            emptyDir: {}
  deployments.yaml: |
    # This is a configuration file that configures
    # the list of branches that we want to continusouly deploy from.
    # The project where things should be deployed
    #
    #
    # TODO(jlewi): This is deprecated. Instead you should add YAML files containing Tekton PipelineRun YAMLs
    # Each PipelineRun should deploy a different sequence of pipelines.
    #
    # TODO(jlewi): Project and zone in which to deploy.
    # Should we define this in the kustomize package because it will be different
    # for different environments and we will want to easily override it?
    project: kubeflow-ci-deployment
    zone: us-east1-c
    # Each version specifies a different combination of versions of KF to deploy.
    versions:
      - name: master
        kfDefUrl: https://raw.githubusercontent.com/kubeflow/manifests/master/kfdef/kfctl_gcp_iap.yaml
        kfctlUrl: https://github.com/kubeflow/kfctl/releases/download/v1.0/kfctl_v1.0-0-g94c35cf_linux.tar.gz
      - name: v1
        # TODO(jlewi): Change to the version on the v1.0 branch once it exists; otherwise we won't redeploy on changes
        # to the manifests
        kfDefUrl: https://raw.githubusercontent.com/kubeflow/manifests/v1.0-branch/kfdef/kfctl_gcp_iap.v1.0.0.yaml
        kfctlUrl: https://github.com/kubeflow/kfctl/releases/download/v1.0/kfctl_v1.0-0-g94c35cf_linux.tar.gz
      - name: stacks
        # TODO(jlewi): We can get rid of this autodeployment once the stacks manifest is incorporated into a versioned
        # manifest. We may need to update the kfctl link as additional fixes to work with kfctl
        kfDefUrl: https://raw.githubusercontent.com/kubeflow/manifests/master/stacks/examples/kfctl_gcp_stacks.experimental.yaml
        kfctlUrl: https://storage.googleapis.com/kubeflow-ci_builds/kfctl/20200413_0845/linux/kfctl
  pipeline-run-deploy-blueprint-master.yaml: "# A Tekton PipelineRune to deploy Kubeflow
    using a blueprint.\n#\n# Several pieces of information in the spec are used to
    configure autodeployments.\n# 1. labels:\n#    auto-deploy-group - Used to group
    auto deployments. Only so many instances will be kept\n#        each pipeline
    run should use a unique value \n#    auto-deploy-base-name: This will be changed
    to name-{uid} to generate a unique name for the deployment\napiVersion: tekton.dev/v1alpha1\nkind:
    PipelineRun\nmetadata:      \n  generateName: deploy-kf-master-\n  namespace:
    auto-deploy\n  labels:\n    auto-deploy-group: gcp-blueprint-master\n    auto-deploy-base-name:
    kf-vbp\nspec:    \n  resources:  \n  - name: blueprint-repo\n    resourceSpec:\n
    \     type: git\n      params:\n        - name: revision\n          value: master\n
    \       - name: url\n          value: https://github.com/kubeflow/gcp-blueprints.git\n
    \ - name: testing-repo\n    resourceSpec:\n      type: git\n      params:\n        -
    name: revision\n          value: master\n        - name: url\n          value:
    https://github.com/kubeflow/testing.git\n  # Need to use a KSA with appropriate
    GSA\n  serviceAccountName: default-editor\n  pipelineRef:\n    name: deploy-gcp-blueprint"
  pipeline-run-deploy-blueprint-v1.1.yaml: "# A Tekton PipelineRune to deploy Kubeflow
    using a blueprint.\n#\n# Several pieces of information in the spec are used to
    configure autodeployments.\n# 1. labels:\n#    auto-deploy-group - Used to group
    auto deployments. Only so many instances will be kept\n#        each pipeline
    run should use a unique value \n#    auto-deploy-base-name: This will be changed
    to name-{uid} to generate a unique name for the deployment\napiVersion: tekton.dev/v1alpha1\nkind:
    PipelineRun\nmetadata:      \n  generateName: deploy-kf-v1-1-\n  namespace: auto-deploy\n
    \ labels:\n    auto-deploy-group: gcp-blueprint-v1-1\n    auto-deploy-base-name:
    kf-v1-1\nspec:    \n  resources:  \n  - name: blueprint-repo\n    resourceSpec:\n
    \     type: git\n      params:\n        - name: revision\n          value: v1.1-branch\n
    \       - name: url\n          value: https://github.com/kubeflow/gcp-blueprints.git\n
    \ - name: testing-repo\n    resourceSpec:\n      type: git\n      params:\n        -
    name: revision\n          value: master\n        - name: url\n          value:
    https://github.com/kubeflow/testing.git\n  # Need to use a KSA with appropriate
    GSA\n  serviceAccountName: default-editor\n  pipelineRef:\n    name: deploy-gcp-blueprint"
kind: ConfigMap
metadata:
  labels:
    service: auto-deploy
  name: auto-deploy-config-2778d8c6c8
  namespace: auto-deploy
