File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ package runtime
1515
1616import (
1717 "context"
18-
18+ "time"
19+
1920 "github.com/go-logr/logr"
2021 "github.com/pkg/errors"
2122 corev1 "k8s.io/api/core/v1"
@@ -279,15 +280,21 @@ func (r *resourceReconciler) Sync(
279280 return err
280281 }
281282 for _ , condition := range latest .Conditions () {
282- if condition .Type == ackv1alpha1 .ConditionTypeResourceSynced &&
283- condition .Status != corev1 .ConditionTrue {
284- rlog .Debug (
285- "requeueing resource after finding resource synced condition false" ,
286- )
287- return requeue .NeededAfter (
288- ackerr .TemporaryOutOfSync ,
289- requeue .DefaultRequeueAfterDuration ,
290- )
283+ if condition .Type == ackv1alpha1 .ConditionTypeResourceSynced {
284+ if condition .Status == corev1 .ConditionTrue {
285+ if duration := r .rmf .RequeueOnSuccessSeconds (); duration > 0 {
286+ rlog .Debug (
287+ "requeueing resource after resource synced condition true" ,
288+ )
289+ return requeue .NeededAfter (nil , time .Duration (duration )* time .Second )
290+ }
291+ } else {
292+ rlog .Debug (
293+ "requeueing resource after finding resource synced condition false" ,
294+ )
295+ return requeue .NeededAfter (
296+ ackerr .TemporaryOutOfSync , requeue .DefaultRequeueAfterDuration )
297+ }
291298 }
292299 }
293300 return nil
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ type AWSResourceManager interface {
7070
7171// AWSResourceManagerFactory returns an AWSResourceManager that can be used to
7272// manage AWS resources for a particular AWS account
73+ // TODO(jaypipes): Move AWSResourceManagerFactory into its own file
7374type AWSResourceManagerFactory interface {
7475 // ResourceDescriptor returns an AWSResourceDescriptor that can be used by
7576 // the upstream controller-runtime to introspect the CRs that the resource
@@ -89,4 +90,7 @@ type AWSResourceManagerFactory interface {
8990 ) (AWSResourceManager , error )
9091 // IsAdoptable returns true if the resource is able to be adopted
9192 IsAdoptable () bool
93+ // RequeueOnSuccessSeconds returns true if the resource should be requeued after specified seconds
94+ // Default is false which means resource will not be requeued after success.
95+ RequeueOnSuccessSeconds () int
9296}
You can’t perform that action at this time.
0 commit comments