@@ -40,6 +40,7 @@ import (
4040)
4141
4242const DEFAULT_RESYNC_INTERVAL = time .Minute
43+ const DEFAULT_RESYNC_INTERVAL_WITH_INSTANT_UPDATES = time .Hour
4344
4445// InfisicalSecretReconciler reconciles a InfisicalSecret object
4546type InfisicalSecretReconciler struct {
@@ -144,19 +145,34 @@ func (r *InfisicalSecretReconciler) Reconcile(ctx context.Context, req ctrl.Requ
144145
145146 }
146147
147- if duration , err := util .ConvertResyncIntervalToDuration (syncConfig .ResyncInterval , true ); err == nil {
148- // successfully parsed the resync interval. if its parsed to 0, we should use the default of 60 seconds
149- if duration != 0 {
150- requeueTime = duration
151- logger .Info (fmt .Sprintf ("resync interval set from syncConfig. interval: %v" , requeueTime ))
148+ // Determine the default resync interval based on InstantUpdates setting
149+ defaultResyncInterval := DEFAULT_RESYNC_INTERVAL
150+ if syncConfig .InstantUpdates {
151+ defaultResyncInterval = DEFAULT_RESYNC_INTERVAL_WITH_INSTANT_UPDATES
152+ }
153+
154+ // Check if ResyncInterval was explicitly provided
155+ resyncIntervalProvided := syncConfig .ResyncInterval != "" && syncConfig .ResyncInterval != "0s"
156+
157+ if resyncIntervalProvided {
158+ if duration , err := util .ConvertResyncIntervalToDuration (syncConfig .ResyncInterval , true ); err == nil {
159+ if duration != 0 {
160+ requeueTime = duration
161+ logger .Info (fmt .Sprintf ("resync interval set from syncConfig. interval: %v" , requeueTime ))
162+ } else {
163+ // Parsed to 0, use default based on InstantUpdates
164+ logger .Info (fmt .Sprintf ("resync interval set to 0, using default of %v" , defaultResyncInterval ))
165+ requeueTime = defaultResyncInterval
166+ }
152167 } else {
153- logger .Info (fmt .Sprintf ("resync interval set to 0, using default of %v" , DEFAULT_RESYNC_INTERVAL ))
154- requeueTime = DEFAULT_RESYNC_INTERVAL
168+ // Failed to parse the resync interval
169+ logger .Error (err , fmt .Sprintf ("failed to parse resync interval from syncConfig, using default of %v. [err=%v]" , defaultResyncInterval , err ))
170+ requeueTime = defaultResyncInterval
155171 }
156172 } else {
157- // failed to parse the resync interval
158- logger .Error ( err , fmt .Sprintf ("failed to parse resync interval from syncConfig , using default of %v. [err =%v] " , DEFAULT_RESYNC_INTERVAL , err ))
159- requeueTime = DEFAULT_RESYNC_INTERVAL
173+ // ResyncInterval not provided, use default based on InstantUpdates
174+ logger .Info ( fmt .Sprintf ("resync interval not provided , using default of %v (instantUpdates =%v) " , defaultResyncInterval , syncConfig . InstantUpdates ))
175+ requeueTime = defaultResyncInterval
160176 }
161177
162178 // Check if the resource is already marked for deletion
0 commit comments