cron-jobs

by WyriHaximus

Helm chartv1.0.0Verified publisher

CronJobs library

About this chart

Cron Jobs

Opinionated helm library chart for easy creation of cron jobs.

Example

Very basic example without any customization:

{{- range $job := .Values.jobs }}
{{- include "cron-jobs.cronjob" $job -}}
{{- end }}

The following values will run a cronjob that sleeps for 1 second any minute

jobs:
  - name: sleep
    schedule: "* * * * *"
    labels:
      cronjob:
        key: value
      jobTemplate:
        key: value
    container:
      command: ["sleep"]
      args: ["1"]
      resources:
        limits:
          cpu: 1m
          memory: 12Mi
        requests:
          cpu: 1m
          memory: 12Mi
    image:
      repository: alpine
      tag: 3.12
      pullPolicy: IfNotPresent

Opinionated decisions

  • A history of 3 failed and 3 successful jobs are kept around for log checking.
  • No restarts
  • No concurrently
  • A single container per cron job
  • cron and name labels are set on each cron job with the name you give it

Deploy cron-jobs with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cron-jobs on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcron-jobs is pinned at v1.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply