apiVersion: batch/v1
kind: CronJob
metadata:
  name: "{{ id }}"
  labels:
    btrix.crawlconfig: "{{ cid }}"
    btrix.org: "{{ oid }}"
{% if userid %}
    btrix.userid: "{{ userid }}"
{% endif %}
    role: "cron-job"

spec:
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 0
  failedJobsHistoryLimit: 2

  schedule: "{{ schedule }}"

  jobTemplate:
    metadata:
      labels:
        btrix.crawlconfig: "{{ cid }}"
        role: "scheduled-crawljob"

    spec:
      suspend: true
      template:
        spec:
          restartPolicy: Never
          containers:
            - name: noop
              image: "docker.io/tianon/true"
              imagePullPolicy: IfNotPresent
