Skip to content

Commit 8329130

Browse files
committed
fix: keep conflict log precedence over handled-error downgrade
retryAwareErrorLogging checked errorHandledByReconciler before the HTTP_CONFLICT special-case, so handled errors that were also KubernetesClientException conflicts no longer emitted the conflict-specific INFO message. The conflict branch is already low-noise (DEBUG + INFO) and provides actionable info, so it now keeps precedence over the handled-error downgrade.
1 parent f4fe8d5 commit 8329130

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/EventProcessor.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,24 +418,26 @@ private void retryAwareErrorLogging(
418418
boolean errorHandledByReconciler,
419419
Exception exception,
420420
ExecutionScope<P> executionScope) {
421-
if (errorHandledByReconciler && !retry.isLastAttempt()) {
422-
// The reconciler already handled the error in updateErrorStatus (and had the chance to log it
423-
// as needed), so while there are retries remaining the framework only logs it on debug level.
424-
// On the last attempt we still fall through to the higher-severity logging below, so a final,
425-
// non-recoverable failure is not hidden from operators.
426-
log.debug(
427-
"Error during event processing {}, but was handled by the reconciler",
428-
executionScope,
429-
exception);
430-
} else if (!retry.isLastAttempt()
421+
if (!retry.isLastAttempt()
431422
&& exception instanceof KubernetesClientException ex
432423
&& ex.getCode() == HttpURLConnection.HTTP_CONFLICT) {
424+
// The conflict branch is already low-noise (DEBUG + INFO) and provides actionable info, so it
425+
// keeps precedence over the handled-error downgrade below.
433426
log.debug("Full client conflict error during event processing {}", executionScope, exception);
434427
log.info(
435428
"Resource Kubernetes Resource Creator/Update Conflict during reconciliation. Message:"
436429
+ " {} Resource name: {}",
437430
ex.getMessage(),
438431
ex.getFullResourceName());
432+
} else if (errorHandledByReconciler && !retry.isLastAttempt()) {
433+
// The reconciler already handled the error in updateErrorStatus (and had the chance to log it
434+
// as needed), so while there are retries remaining the framework only logs it on debug level.
435+
// On the last attempt we still fall through to the higher-severity logging below, so a final,
436+
// non-recoverable failure is not hidden from operators.
437+
log.debug(
438+
"Error during event processing {}, but was handled by the reconciler",
439+
executionScope,
440+
exception);
439441
} else if (eventPresent || !retry.isLastAttempt()) {
440442
log.warn(
441443
"Uncaught error during event processing {} - but another reconciliation will be attempted"

0 commit comments

Comments
 (0)