File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed
Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 4949 // after some wait time
5050 TemporaryOutOfSync = fmt .Errorf (
5151 "temporary out of sync, reconcile after some time" )
52+ // TemporaryOutOfSync is to indicate the error isn't really an error
53+ // but more of a marker that the status check will be performed
54+ // after some wait time
55+ RequeueOnSuccess = fmt .Errorf (
56+ "resource creation successful but reconcile after some time" )
5257 // Terminal is returned with resource is in Terminal Condition
5358 Terminal = fmt .Errorf (
5459 "resource is in terminal condition" )
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ const (
2121 DefaultRequeueAfterDuration time.Duration = 30 * time .Second
2222)
2323
24+ // GetDurationInSeconds converts an integer into a time duration in seconds
25+ func GetDurationInSeconds (duration int ) time.Duration {
26+ return time .Duration (duration ) * time .Second
27+ }
28+
2429// Needed returns a new RequeueNeeded to instruct the ACK runtime to requeue
2530// the processing item without been logged as error.
2631func Needed (err error ) * RequeueNeeded {
Original file line number Diff line number Diff line change @@ -271,10 +271,17 @@ func (r *resourceReconciler) Sync(
271271 return err
272272 }
273273 for _ , condition := range latest .Conditions () {
274- if condition .Type == ackv1alpha1 .ConditionTypeResourceSynced &&
275- condition .Status != corev1 .ConditionTrue {
276- return requeue .NeededAfter (
277- ackerr .TemporaryOutOfSync , requeue .DefaultRequeueAfterDuration )
274+ if condition .Type == ackv1alpha1 .ConditionTypeResourceSynced {
275+ if condition .Status == corev1 .ConditionTrue {
276+ duration , status := r .rmf .GetRequeueOnSuccessSeconds ()
277+ if status {
278+ return requeue .NeededAfter (
279+ ackerr .RequeueOnSuccess , requeue .GetDurationInSeconds (duration ))
280+ }
281+ } else {
282+ return requeue .NeededAfter (
283+ ackerr .TemporaryOutOfSync , requeue .DefaultRequeueAfterDuration )
284+ }
278285 }
279286 }
280287 return nil
Original file line number Diff line number Diff line change @@ -89,4 +89,7 @@ type AWSResourceManagerFactory interface {
8989 ) (AWSResourceManager , error )
9090 // IsAdoptable returns true if the resource is able to be adopted
9191 IsAdoptable () bool
92+ // GetRequeueOnSuccessSeconds returns true if the resource should be requeued after specified seconds
93+ // Default is false which means resource will not be requeued after success.
94+ GetRequeueOnSuccessSeconds () (int , bool )
9295}
You can’t perform that action at this time.
0 commit comments