K8S - Use "Last Schedule" of a CronJob as a parameters in container command

1/23/2020

I created a Cronjob that is scheduled for every morning, from Monday to Friday.

schedule: "30 7 * * 1-5"

The job synchronize a database with a datawarehouse. As I do not want to sync all the database everyday, I want to be able to give two parameters in the command container's section of my CronJob ; last time the job started and now:

containers:
- image: xxx
  name: dwh
  command: ["/bin/bash", "-c", "rake etl:sync LAST_TIME_SCHEDULED NOW"]
  resources: {}

How can I get the "Last Schedule" timestamp of the CronJob in this situation, and the timestamp of now ?

-- Maloz
kubernetes
kubernetes-cronjob

0 Answers