hiddeco / cronjobber

Cronjobber is a cronjob controller for Kubernetes with support for time zones
Apache License 2.0
244 stars 38 forks source link

Run tzcronjob now #21

Closed hugochinchilla closed 5 years ago

hugochinchilla commented 5 years ago

With regular cronjobs you can create jobs from a cronjob when you want to run a task inmediatly:

kubectl create job --from=cronjob/<name of cronjob> <name of job>

With cronjobber this does not work:

$ kubectl create job --from=tzcronjob/update-campaign-metrics update-campaign-metrics-now
error: from must be an existing cronjob: no kind "TZCronJob" is registered for version "cronjobber.hidde.co/v1alpha1" in scheme "k8s.io/kubernetes/pkg/kubectl/scheme/scheme.go:28"
$ kubectl create job --from=cronjob/update-campaign-metrics update-campaign-metrics-now
Error from server (NotFound): cronjobs.batch "update-campaign-metrics" not found

Would it be possible to fix this?

hiddeco commented 5 years ago

See #19

hugochinchilla commented 5 years ago

thanks!

arobert-delfingen commented 3 years ago

I saw that "kubectl create job --from=tzcronjob/xxxx" will not be implemented, but is there a workaround to manually and immediatly trigger a Timezone Cron Job ?

arobert-delfingen commented 3 years ago

The workaround I found is to duplicate the TZCronJob I need to trigger manually in a standard CronJob at status suspended . So the TZCronJob is automatically triggered by kubernetes at the right Timezone, and manually I can run the always suspended standard cronjob through the command kubectl create job --from=cronjob/xxxx