Skip to content

kkothule/cronjobber-kubebuilder

Repository files navigation

Cronjobber

Cronjobber is re-written using kubebuilder with reference from project https://github.com/hiddeco/cronjobber. the cronjob controller from Kubernetes patched with time zone support. This is only for pratice purpose

Installation

# Install everything in one go
$ kubectl apply -f https://raw.githubusercontent.com/kkothule/cronjobber/main/deploy/manifests.yaml

Usage

Instead of creating a CronJob like you normally would, you create a TZCronJob, which works exactly the same but supports an additional field: .spec.timezone. Set this to the time zone you wish to schedule your jobs in and Cronjobber will take care of the rest.

apiVersion: tzcronjob.github.com/v1
kind: TZCronjob
metadata:
  name: tzcronjob-sample
spec:
  schedule: "*/1 * * * *"
  timezone: "Europe/Amsterdam"
  successfulJobsHistoryLimit: 2
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: hello
              image: busybox
              args:
                - /bin/sh
                - -c
                - date; echo "Hello, World!"
          restartPolicy: OnFailure

Credits

This application is derived from open source components. You can find the original source code of these components below.