Class: CronKubernetes::CronTab
- Inherits:
-
Object
- Object
- CronKubernetes::CronTab
- Defined in:
- lib/cron_kubernetes/cron_tab.rb
Overview
The “table” of Kubernetes CronJobs that we manage in the cluster.
Instance Method Summary collapse
-
#update(schedule = nil) ⇒ Object
“Apply” the new configuration - remove from cluster any cron_jobs that are no longer in the schedule - add new jobs - update cron_jobs that exist (deleting a cron_job deletes the job and pod).
Instance Method Details
#update(schedule = nil) ⇒ Object
“Apply” the new configuration
- remove from cluster any cron_jobs that are no longer in the schedule
- add new jobs
- update cron_jobs that exist (deleting a cron_job deletes the job and pod)
10 11 12 13 14 15 16 |
# File 'lib/cron_kubernetes/cron_tab.rb', line 10 def update(schedule = nil) schedule ||= CronKubernetes::Scheduler.instance.schedule add, change, remove = diff_schedules(schedule, current_cron_jobs) remove.each { |job| remove_cron_job(job) } add.each { |job| add_cron_job(job) } change.each { |job| update_cron_job(job) } end |