@@ -285,6 +285,7 @@ type staticResourceReconciler struct {
285285 conditions []configv1.ClusterOperatorStatusCondition
286286 cache resourceapply.ResourceCache
287287 podIdentityType PodIdentityManifestSource
288+ degradedSince time.Time
288289}
289290
290291var _ reconcile.Reconciler = & staticResourceReconciler {}
@@ -294,16 +295,22 @@ func (r *staticResourceReconciler) Reconcile(ctx context.Context, request reconc
294295 err := r .ReconcileResources (ctx )
295296 if err != nil {
296297 r .logger .Errorf ("reconciliation failed, retrying in %s" , retryInterval .String ())
297- r .conditions = []configv1.ClusterOperatorStatusCondition {
298- {
299- Type : configv1 .OperatorDegraded ,
300- Status : configv1 .ConditionTrue ,
301- Reason : reasonStaticResourceReconcileFailed ,
302- Message : fmt .Sprintf ("static resource reconciliation failed: %v" , err ),
303- },
298+ if r .degradedSince .IsZero () {
299+ r .degradedSince = time .Now ()
300+ } else if time .Since (r .degradedSince ) > 5 * time .Minute {
301+ r .conditions = []configv1.ClusterOperatorStatusCondition {
302+ {
303+ Type : configv1 .OperatorDegraded ,
304+ Status : configv1 .ConditionTrue ,
305+ Reason : reasonStaticResourceReconcileFailed ,
306+ Message : fmt .Sprintf ("static resource reconciliation failed: %v" , err ),
307+ },
308+ }
304309 }
305310 return reconcile.Result {RequeueAfter : retryInterval }, err
306311 }
312+
313+ r .degradedSince = time.Time {}
307314 r .conditions = []configv1.ClusterOperatorStatusCondition {}
308315 return reconcile.Result {}, nil
309316}
0 commit comments