Skip to content

Commit

Permalink
Remove missed runs check
Browse files Browse the repository at this point in the history
This check caused TF applier to completely stop applying all modules
when it has been down for some time which is not the behaviour we want
in terraform applier.
  • Loading branch information
DTLP committed Oct 16, 2023
1 parent 73a8644 commit 01f350c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
3 changes: 0 additions & 3 deletions controllers/module_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ func NextSchedule(module *tfaplv1beta1.Module, now time.Time, minIntervalBetween
// of this controller. In that case, we want to not try to list
// all the missed start times.
numOfMissedRuns++
if numOfMissedRuns > 100 {
return 0, time.Time{}, fmt.Errorf("too many missed start times (%d) check clock skew", numOfMissedRuns)
}
}

return numOfMissedRuns, sched.Next(now), nil
Expand Down
30 changes: 15 additions & 15 deletions controllers/module_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ func Test_NextSchedule(t *testing.T) {
},
wantErr: true,
},
{
name: "no_job_run_for_days",
args: args{
module: &tfaplv1beta1.Module{
ObjectMeta: metav1.ObjectMeta{
CreationTimestamp: metav1.Time{Time: time.Date(2022, 02, 01, 01, 00, 00, 0000, time.UTC)},
},
Spec: tfaplv1beta1.ModuleSpec{Schedule: "00 */1 * * *"},
Status: tfaplv1beta1.ModuleStatus{RunStartedAt: nil},
},
now: time.Date(2022, 03, 01, 01, 00, 00, 0000, time.UTC),
minIntervalBetweenRuns: time.Hour,
},
wantErr: true,
},
// {
// name: "no_job_run_for_days",
// args: args{
// module: &tfaplv1beta1.Module{
// ObjectMeta: metav1.ObjectMeta{
// CreationTimestamp: metav1.Time{Time: time.Date(2022, 02, 01, 01, 00, 00, 0000, time.UTC)},
// },
// Spec: tfaplv1beta1.ModuleSpec{Schedule: "00 */1 * * *"},
// Status: tfaplv1beta1.ModuleStatus{RunStartedAt: nil},
// },
// now: time.Date(2022, 03, 01, 01, 00, 00, 0000, time.UTC),
// minIntervalBetweenRuns: time.Hour,
// },
// wantErr: true,
// },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 01f350c

Please sign in to comment.