hiddeco / cronjobber

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

Not able to suspend CronJob #42

Closed pabrahamusa closed 3 years ago

pabrahamusa commented 3 years ago

During maintenance purpose I want to disable all CronJobs, For default Kubernetes CronJob we can execute following command

kubectl patch cronjobs <job-name> -p '{"spec" : {"suspend" : true }}'

However I cannot see an option to do this in CronJobber . Is there a way to disable and enable Cronjob without playing with schedules.

bip7686 commented 3 years ago

You can do exactly the same with tzcronjobs. Just specify tzcronjobs instead of cronjobs.

pabrahamusa commented 3 years ago

@Luis-TT it is not working , I tried following and getting error.

$>  kubectl patch tzcronjob cronjob-runnightlyjobs -p '{"spec" : {"suspend" : true }}'
Error from server (UnsupportedMediaType): the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
hiddeco commented 3 years ago

kubectl patch defaults to strategic, which is not supported for Custom Resource types, you need to use a --type=merge strategy.