furiko-io / furiko

Kubernetes cron and batch job platform
https://furiko.io
Apache License 2.0
478 stars 21 forks source link

Feature: Support NotDuring constraints for JobConfig #53

Open irvinlim opened 2 years ago

irvinlim commented 2 years ago

Users may want to have a periodically scheduled job that runs regularly on interval, except for some explicitly defined time ranges. For example, we may want to specify that during deploy freezes or some other real-world event, a cron job should not be run.

Users should be able to specify a list of time ranges (start and end time, inclusive), during which schedules are not allowed.

API Design

apiVersion: execution.furiko.io/v1alpha1
kind: JobConfig
metadata:
  name: my-job-config
  namespace: my-namespace
spec:
  schedule:
    # Schedule every hour from 10AM to 6PM.
    cron:
      expression: 0 10-18 * * *
      timezone: Asia/Singapore
    constraints:
      # Example of multiple notDuring freeze periods, inclusive.
      notDuring:
        - start: 2022-04-01T00:00:00+08:00
          end: 2022-04-02T11:59:59+08:00
        - start: 2022-04-28T00:00:00+08:00
          end: 2022-04-28T15:59:59+08:00

Using the above example:

Possible Extensions