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 with time zone #2104

Closed
andrea-pavan opened this issue Sep 2, 2024 · 4 comments · Fixed by #2191
Closed

Cronjob with time zone #2104

andrea-pavan opened this issue Sep 2, 2024 · 4 comments · Fixed by #2191
Labels

Comments

@andrea-pavan
Copy link

andrea-pavan commented Sep 2, 2024

What happened?

It's not possible to create a Cronjob with time zone defined in vcluster.
When try to submit the manifest, you receive the error:

The CronJob "xyz" is invalid: spec.timeZone: Invalid value: "XXX/YYY" unknown time zone XXX/YYY

What did you expect to happen?

Able to create Cronjob.
Presence of timezone file where Kubernetes looks for time zones info.

How can we reproduce it (as minimally and precisely as possible)?

Create a fresh vcluster.
Try to schedule this CronJob

apiVersion: batch/v1
kind: CronJob
metadata:
  name: hello
spec:
  schedule: "* * * * *"
  timeZone: Europe/Rome
  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

Anything else we need to know?

The same issue was present in older versions of k3s.
They solved by adding tzdata package in their Alpine-based Docker images.
Before syncer/k3s merge, we was able to solve the issue just by upgrading k3s image.

Host cluster Kubernetes version

$ kubectl version
Client Version: v1.30.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.0+k3s1

vcluster version

$ vcluster --version
vcluster version 0.19.7

VCluster Config

Default config

Copy link
Contributor

Can you try to see if you have the same issue with v0.20 and the new default vanilla k8s distro (instead of with k3s)? Or is there a reason why you need to use k3s?

@andrea-pavan
Copy link
Author

andrea-pavan commented Sep 6, 2024

This is a production system that use k3s because it was the only one available in the past. Not so easy for us to upgrade at the moment as we use vCluster for long running k3s clusters with persistence backed in a PostgreSQL database. v0.20 seems to us a bit "disrupting" and need more testing before planning an upgrade path. Further, in the release notes is stated that switching distributions is not supported

@FabianKramm
Copy link
Member

@andrea-pavan sorry for the late response. We need to add the package tzdata to our Dockerfile which should resolve this issue. I created a fix for this in #2191

@andrea-pavan
Copy link
Author

Thanks @FabianKramm for reply and the fix. Will be backported to version 0.19.x also?

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

Successfully merging a pull request may close this issue.

3 participants