Skip to content

Commit

Permalink
change REQUEUE_RECONCILIATION_IMMEDIATELY to ..._AFTER for flexibility
Browse files Browse the repository at this point in the history
Signed-off-by: Ryotaro Banno <[email protected]>
  • Loading branch information
ushitora-anqou committed Jan 14, 2025
1 parent 5b01b6c commit de143df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions internal/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ func IsJobConditionTrue(conditions []batchv1.JobCondition, conditionType batchv1
}

func requeueReconciliation() ctrl.Result {
requeueAfter := os.Getenv("REQUEUE_RECONCILIATION_IMMEDIATELY")
if requeueAfter == "1" {
return ctrl.Result{RequeueAfter: time.Second}
requeueAfter := os.Getenv("REQUEUE_RECONCILIATION_AFTER")
if requeueAfter != "" {
duration, err := time.ParseDuration(requeueAfter)
if err != nil {
panic(fmt.Sprintf("set REQUEUE_RECONCILIATION_AFTER properly: %v", err))
}
return ctrl.Result{RequeueAfter: duration}
}
return ctrl.Result{Requeue: true}
}
4 changes: 2 additions & 2 deletions test/e2e/testdata/values-mantle-primary-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ controller:
#httpsProxy: http://host.minikube.internal:8899
#noProxy: localhost,127.0.0.1,10.96.0.0/12
env:
- name: REQUEUE_RECONCILIATION_IMMEDIATELY
value: "1"
- name: REQUEUE_RECONCILIATION_AFTER
value: "1s"

0 comments on commit de143df

Please sign in to comment.