browsertrix/backend/btrixcloud/templates/crawl_cron_job.yaml
Ilya Kreymer c9c39d47b7
Scheduled Crawl Refactor: Handle via Operator + Add Skipped Crawls on Quota Reached (#1162)
* use metacontroller's decoratorcontroller to create CrawlJob from Job
* scheduled job work:
- use existing job name for scheduled crawljob
- use suspended job, set startTime, completionTime and succeeded status on job when crawljob is done
- simplify cronjob template: remove job_image, cron_namespace, using same namespace as crawls,
placeholder job image for cronjobs

* move storage quota check to crawljob handler:
- add 'skipped_quota_reached' as new failed status type
- check for storage quota before checking if crawljob can be started, fail if not (check before any pods/pvcs created)

* frontend:
- show all crawls in crawl workflow, no need to filter by status
- add 'skipped_quota_reached' status, show as 'Skipped (Quota Reached)', render same as failed

* migration: make release namespace available as DEFAULT_NAMESPACE, delete old cronjobs in DEFAULT_NAMESPACE and recreate in crawlers namespace with new template
2023-09-12 13:05:43 -07:00

31 lines
601 B
YAML

apiVersion: batch/v1
kind: CronJob
metadata:
name: "{{ id }}"
labels:
btrix.crawlconfig: "{{ cid }}"
role: "cron-job"
spec:
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 2
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