Skip to main content

How schedulers work on GKE?

We have three long living branches and each branch has own helm configuration file, those are

envvalues file
alpha.helm/values.alpha.yaml
staging.helm/values.staging.yaml
production.helm/values.yaml

.helm/values.yaml is the parent file thus having the most comprehensive configurations list

Note that child config files, such as .helm/values.alpha.yaml, by default inherit evertything from parent file, except the few that are configured in child file, those will override values from parent file

Schedulers in k8s are called cronjobs, they follow general cron syntax and when time is right k8s will deploy separate pod and execute the command that is written in sidekiq.cronjob.crons section of values.yaml

To add a new cronjob you should add an object with corresponding number (0,1,2,3...) to values{environment}.yaml
and provide command and schedule, where command is bundle exec rake {name_of_rake_task}
and schedule in cron format (use crontab.guru for easy cron schedules)

Then prepare a pull request and add @yili and @ali as reviewers, once you merge your pr it's all set

To check the schedule and active cronjobs run this:

kubectl -n cronjobs get jobs --watch

To check logs of particular cronjob

kubectl -n cronjobs logs cronjob.batch/{name_of_cronjob}

Quick overview of all cronjobs and their last messages

kubectl -n cronjobs get events