Skip to content

Commit

Permalink
Update cronjobs to forbid concurrency
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Parraga <[email protected]>
  • Loading branch information
Sovietaced committed Dec 10, 2024
1 parent 122dba3 commit 51a781f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/controller/install/lookout_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ func createLookoutCronJob(lookout *installv1alpha1.Lookout, serviceAccountName s
Annotations: map[string]string{"checksum/config": GenerateChecksumConfig(lookout.Spec.ApplicationConfig.Raw)},
},
Spec: batchv1.CronJobSpec{
Schedule: dbPruningSchedule,
ConcurrencyPolicy: batchv1.ForbidConcurrent,
Schedule: dbPruningSchedule,
JobTemplate: batchv1.JobTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down
1 change: 1 addition & 0 deletions internal/controller/install/lookout_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ func TestLookoutReconciler_CreateCronJob(t *testing.T) {
},
},
Spec: batchv1.CronJobSpec{
ConcurrencyPolicy: batchv1.ForbidConcurrent,
JobTemplate: batchv1.JobTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: "lookout-db-pruner",
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/install/scheduler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ func newSchedulerCronJob(scheduler *installv1alpha1.Scheduler, serviceAccountNam
Annotations: map[string]string{"checksum/config": GenerateChecksumConfig(scheduler.Spec.ApplicationConfig.Raw)},
},
Spec: batchv1.CronJobSpec{
Schedule: scheduler.Spec.Pruner.Schedule,
Schedule: scheduler.Spec.Pruner.Schedule,
ConcurrencyPolicy: batchv1.ForbidConcurrent,
JobTemplate: batchv1.JobTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down
1 change: 1 addition & 0 deletions internal/controller/install/scheduler_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ func TestSchedulerReconciler_createSchedulerCronJob(t *testing.T) {
},
},
Spec: batchv1.CronJobSpec{
ConcurrencyPolicy: batchv1.ForbidConcurrent,
JobTemplate: batchv1.JobTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: "scheduler-db-pruner",
Expand Down

0 comments on commit 51a781f

Please sign in to comment.