hiddeco / cronjobber

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

[Q&A] Programmatically create a TZCronJob #27

Closed afabriciof closed 3 years ago

afabriciof commented 4 years ago

Great Job! Thanks for sharing!.

I have a (probably) dummy question. How can I programmatically create a TZCronJob (in particular, I am using python). Is there and endpoint I need to call?

As reference, for regular CronJob, I am using pip package kubernetes==9.0.0 doing this:

cron_job.spec = V1beta1CronJobSpec(job_template=job_template, schedule=schedule)

client.BatchV1beta1Api(self._client).create_namespaced_cron_job(namespace_name, body=cron_job)

which in turn ends up calling

'/apis/batch/v1beta1/namespaces/{namespace}/cronjobs', 'POST'

Any advise very welcomed! Alex

Nick-Triller commented 3 years ago

Hi @afabriciof, the issue is kind of old, but just in case: you can find an example of how to create custom resources with the Python Kubernetes client here: https://github.com/kubernetes-client/python/blob/master/examples/custom_object.py

I think this issue can be closed.

afabriciof commented 3 years ago

Thank you Nick, yes please go ahead and close the ticket.

On Tue, Apr 27, 2021 at 5:41 AM Nick Triller @.***> wrote:

Hi @afabriciof https://github.com/afabriciof, the issue is kind of old, but just in case: you can find an example of how to create custom resources with the Python Kubernetes client here: https://github.com/kubernetes-client/python/blob/master/examples/custom_object.py

I think this issue can be closed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hiddeco/cronjobber/issues/27#issuecomment-827429947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDNLK77QFV4TM737HPCQFDTKZ2EJANCNFSM4O5ALEXA .