Skip to content

How is time zone information sent from the k8s resource to the cronitor api? #50

@jeremiahishere

Description

@jeremiahishere

I am using cronitor-kubernetes to migrate a system from a crontab to a k8s CronJob resources. I can't figure out how to update the time zone in the cronitor.io record based on annotations or resource attributes on the k8s CronJob. I have a fairly standard setup that looks like this:

apiVersion: batch/v1
kind: CronJob
metadata:
  annotations:
    k8s.cronitor.io/cronitor-grace-seconds: '600'
    k8s.cronitor.io/cronitor-id: <id>
    k8s.cronitor.io/cronitor-name: <name>
    k8s.cronitor.io/env: production
    k8s.cronitor.io/include: 'true'
    k8s.cronitor.io/tags: <tags>
spec:
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - command:
                - my_script
                - arg1
                - arg2
     ...
  schedule: '*/15 11,12 * * *'
  timeZone: "America/New_York"
status: {}

This example runs on US eastern/daylight time on the pod but still uses the default UTC time on the cronitor.io record. I need to run crons based on local time zones all over the world that include local daylight savings time changes. UTC isn't an option for my use case.

I dug into the code a bit and noticed that there is no obvious timezone information sent to the cronitor api in this structure: https://github.com/cronitorio/cronitor-kubernetes/blob/main/pkg/api/jobs.go#L20-L31. Is there another way to pass timezone info to the api?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions