apiVersion: btrix.cloud/v1
kind: CrawlJob
metadata:
  name: crawljob-{{ id }}
  labels:
    crawl: "{{ id }}"
    role: {{ "qa-job" if qa_source else "job" }}
    btrix.org: "{{ oid }}"
    btrix.user: "{{ userid }}"
    btrix.storage: "{{ storage_name }}"

spec:
  selector:
    matchLabels:
      crawl: "{{ id }}"

  id: "{{ id }}"
  userid: "{{ userid }}"
  cid: "{{ cid }}"
  oid: "{{ oid }}"
  scale: {{ scale }}

  profile_filename: "{{ profile_filename }}"
  storage_filename: "{{ storage_filename }}"

  maxCrawlSize: {{ max_crawl_size if not qa_source else 0 }}
  timeout: {{ timeout if not qa_source else 0 }}
  qaSourceCrawlId: "{{ qa_source }}"

  manual: {{ manual }}
  crawlerChannel: "{{ crawler_channel }}"
  ttlSecondsAfterFinished: {{ 30 if not qa_source else 0 }}
  warcPrefix: "{{ warc_prefix }}"

  storageName: "{{ storage_name }}"

  proxyId: "{{ proxy_id }}"
