Manage Multiple Cron with Helm Flow Control

Creating a single CronJob:

Create a cronjob by copying the following code.

Creating multiple Cronjob Commands:

Now let's create multiple cronjob commands which will hold all unique placeholders. We will now create a separate cronjob file that will hold the values i.e name, frequency, command etc of cron. Let's create a cronjobs.yaml inside .helm/values/cronjobs.yaml.

Pass dynamic values to helm template:

So far we have worked single cronjob then we created multiple cronjob commands. Now we want to loop those cronjobs commands inside the single cronjob so that we do not have to create multiple files manually.

helm upgrade — install — values “.helm/values/cronjobs.yaml” multiple-cronjobs .helm

Conclusion:

We set up multiple cronjobs using two files one for defining the specs of the whole Kubernetes cronjob and the next for defining the dynamic values i.e command, frequency, name, etc. You can build/manage complex configurations using the Helm Flow Control.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store