Skip to content

Commit

Permalink
Merge pull request #2216 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2179-to-release-4.14

[release-4.14] OCPBUGS-25800: Wait for 3 (instead of 2) consecutive failing reconcil…
  • Loading branch information
openshift-merge-bot[bot] committed Jan 30, 2024
2 parents 024378a + d748206 commit bfc823b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func (pc *ProxyConfig) NoProxy() string {
const (
resyncPeriod = 15 * time.Minute
reconciliationPeriod = 5 * time.Minute
maxFailCount = 2

// see https://github.com/kubernetes/apiserver/blob/b571c70e6e823fd78910c3f5b9be895a756f4cbb/pkg/server/options/authentication.go#L239
apiAuthenticationConfigMap = "kube-system/extension-apiserver-authentication"
Expand Down Expand Up @@ -760,11 +759,16 @@ func (o *Operator) sync(ctx context.Context, key string) error {

func (o *Operator) reportFailed(ctx context.Context, report runReport) {
o.failedReconcileAttempts++
klog.Infof("ClusterOperator reportFailed (attempt %d).", o.failedReconcileAttempts)

if o.failedReconcileAttempts < maxFailCount {
klog.Infof("ClusterOperator reconciliation %d - skipping update", o.failedReconcileAttempts)
// Rate limit to avoid unnecessary status updates for temporary or transient errors that may resolve themselves within a few attempts.
// Ensure you have thoroughly considered all implications before adjusting the threshold.
// See: https://issues.redhat.com/browse/OCPBUGS-23745
maxAttempts := 3
if o.failedReconcileAttempts < maxAttempts {
klog.Infof("%d reconciliation(s) failed, %d more attempt(s) will be made before reporting failures.", o.failedReconcileAttempts, maxAttempts-o.failedReconcileAttempts)
return
} else {
klog.Infof("%d reconciliations failed in a row, the threshold of %d attempts has been reached, failures will be reported.", o.failedReconcileAttempts, maxAttempts)
}

if err := o.client.StatusReporter().ReportState(ctx, report); err != nil {
Expand Down

0 comments on commit bfc823b

Please sign in to comment.