Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cronjob TimeZone in >=1.27, TZ not found #32

Open
kirinnee opened this issue Dec 31, 2023 · 1 comment
Open

Cronjob TimeZone in >=1.27, TZ not found #32

kirinnee opened this issue Dec 31, 2023 · 1 comment

Comments

@kirinnee
Copy link

when trying to apply the timeZone field for Kubernetes cronjob kind:

CronJob.batch "helium-scheduler" is invalid: spec.timeZone: Invalid value: "Asia/Singapore": unknown time zone Asia/Singapore

Where can I check the supported timezone or if this feature is available?

@timoreimann
Copy link

👋

According to the documentation of the CronJobSpec section, all time zones from this Wikipedia page should work, which includes Asia/Singapore.

I just extended the documented CronJob example by the timeZone field as following:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: hello
spec:
  schedule: "* * * * *"
  timeZone: Asia/Singapore
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox:1.28
            imagePullPolicy: IfNotPresent
            command:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure

It applies correctly for me:

$ kubectl version
Client Version: v1.28.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.6

$ kubectl apply -f cj.yaml
cronjob.batch/hello created

Are you using the correct API version batch/v1? If so, could you please share the relevant portions of your CronJob manifest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants