GAP Documentation
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Cron jobs

In order to execute the tasks in a Kubernetes CronJob, the scheduling have to be converted to cron format. Some examples can be found in the table below. For more information visit crontab guru.

Schedulecron schedule expression
Every 10 minutes*/10 * * * *edit
Every hour at… :000 * * * *edit
Every hour at… :2020 * * * *edit
Every day at… 12:00 AM0 12 * * *edit
Every day at… 4:30 AM30 4 * * *edit

To define a cronjob you need to define a cronJobs in your gap.yaml every element in the cronJobs list is going to be a cronjob. More on gap.yaml here.

name: <your-app-name>
namespace: <your-teams-namespace>
cronJobs:
  <your-cronjob-name>:
      schedule: <your-cron-expression>
      command:
        - <your-command-to-run>
      activeDeadlineSeconds: 60

You can change CronJob configs per environment:

Suspend a job.

gap/production/gap.yaml

name: my-app
namespace: my-namespace
cronJobs:
  my-cronjob:
    suspend: true

Change schedule in staging environment.

gap/staging/gap.yaml

name: my-app
namespace: my-namespace
cronJobs:
  my-cronjob:
    schedule: 0 10 0 * *

Time Zones

To provide a time zone for the schedule to be interpreted in, the cronJobs.<your-cronjob-name>.timeZone field can be used.

name: <your-app-name>
namespace: <your-teams-namespace>
cronJobs:
  <your-cronjob-name>:
      schedule: <your-cron-expression>
      # provide a valid tz-identifier for the timeZone field. Example: "Asia/Baku"
      timeZone: <tz-identifier>

See this document for valid time zone identifiers.