# Source https://raw.githubusercontent.com/kubernetes/test-infra/master/prow/cluster/branchprotector_cronjob.yaml
# Changed: schedule and removed github-endpoint's (we don't have gh proxy)

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  namespace: default
  name: branchprotector
spec:
  schedule: "*/30 * * * *" # Every 30 minutes
  concurrencyPolicy: Forbid
  jobTemplate:
    metadata:
      labels:
        app: branchprotector
    spec:
      template:
        spec:
          containers:
            - name: branchprotector
              image: gcr.io/k8s-prow/branchprotector:v20190125-2aca69d
              args:
                - --config-path=/etc/config/config.yaml
                - --job-config-path=/etc/job-config
                - --github-token-path=/etc/github/oauth
                - --confirm
                - --github-endpoint=http://ghproxy
                - --github-endpoint=https://api.github.com
              volumeMounts:
                - name: oauth
                  mountPath: /etc/github
                  readOnly: true
                - name: config
                  mountPath: /etc/config
                  readOnly: true
                - name: job-config
                  mountPath: /etc/job-config
                  readOnly: true
          restartPolicy: Never
          volumes:
            - name: oauth
              secret:
                secretName: oauth-token
            - name: config
              configMap:
                name: config
            - name: job-config
              configMap:
                name: job-config
