With App Engine GAE, we will usually have yaml with different cron tasks as follows:
cron:
# Notifications Job
- description: "Remove Notifications Cron Weekly run"
url: /tasks/notifications
schedule: every monday 09:00
timezone: Australia/NSW
# Jobs job
- description: "Remove Deleted Jobs / completed"
url: /tasks/jobs/deleted_completed_drafts
schedule: every monday 09:00
timezone: Australia/NSW
# Marketplace job
- description: "Remove Deleted Products / soldout"
url: /tasks/products/deleted_soldout_drafts
schedule: every monday 09:00
timezone: Australia/NSW
I moved to GKE, I can't figure out yet exactly how to run the above cron tasks from one file:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: Cron Task
spec:
schedule: "*/1 0 0 * * 0" #"*/1 * * * *"
startingDeadlineSeconds: 104444
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
containers:
- name: callout
image: gcr.io/my-site/mysite-kubernetes:v0.0.16
args:
- /bin/sh
- -ec
- curl https://www.ksite.com/tasks/notifications
restartPolicy: Never
So how do I arrange the GKE Cron file to accommodate all the above tasks? Do I have to write different(codes) for each different task?
The schedule should be every Monday 09:00 timezone: Australia/NSW. Is schedule: "*/1 0 0 * * 0" a correct representation of that?
Do I have to specify an image, cause the web-deployment script already has the image specified?
I am not too familiar with App Engine, but
CronJob
schedule: times are based on the timezone of the kube-controller-manager according to the docsCronJob
is running in the same cluster as the app, you don't need to go over the Loadbalancer, you can as well use the service like http://service-name/tasks/notifications
Cronjobs
than to try to cram all three calls into one.