Add opt-in patch mode for CronJob reload strategy#1100
Add opt-in patch mode for CronJob reload strategy#1100akshat-kumar-singhal wants to merge 2 commits into
Conversation
Add new annotation `reloader.stakater.com/cronjob-reload-strategy: patch` that allows CronJobs to be patched instead of creating immediate Jobs. When enabled: - Patches the CronJob template so future scheduled runs get new config - Recreates any running Jobs owned by the CronJob - Does NOT create an extra immediate Job Default behavior (creating immediate Job) remains unchanged for backward compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the new `reloader.stakater.com/cronjob-reload-strategy: patch` annotation in the README under section 4 (Workload-Specific Reload Strategies). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@akshat-kumar-singhal You may be interested in #1098 in which I take a simpler approach to job re-creation by way of deleting the pods for any active jobs and allowing the job controller to handle re-creation as appropriate. This has the advantage of retaining the history of any given job and also properly respecting job restart policies. |
Thanks @trvrnrth for reviewing this. Though I don't agree with the current implementation (spawning of an orphan job on config update), #1098 breaks that behaviour. Would you consider adding another annotation to handle this? |
Summary
reloader.stakater.com/cronjob-reload-strategy: patchthat allows CronJobs to use patch mode instead of creating immediate JobsProblem
When a ConfigMap/Secret is updated, Reloader creates an immediate Job from the CronJob template. This causes:
concurrencyPolicySolution
Add an opt-in
patchstrategy that:Usage
Test plan
PatchCronJob,RecreateRunningJobsForCronJob,UpdateCronJobWithRunningJobs)GetCronJobPatchFuncsandGetCronJobCreateJobFuncspatchannotation, update ConfigMap → verify CronJob template is patched, NO immediate Job created