File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ private void handleRetryOnException(ExecutionScope executionScope) {
174174 }
175175 Optional <Long > nextDelay = execution .nextDelay ();
176176
177- nextDelay .ifPresent (
177+ nextDelay .ifPresentOrElse (
178178 delay -> {
179179 log .debug (
180180 "Scheduling timer event for retry with delay:{} for resource: {}" ,
@@ -183,6 +183,9 @@ private void handleRetryOnException(ExecutionScope executionScope) {
183183 eventSourceManager
184184 .getRetryTimerEventSource ()
185185 .scheduleOnce (executionScope .getCustomResource (), delay );
186+ },
187+ () -> {
188+ log .error ("Exhausted retries for {}" , executionScope );
186189 });
187190 }
188191
Original file line number Diff line number Diff line change 66
77import io .fabric8 .kubernetes .api .model .KubernetesResourceList ;
88import io .fabric8 .kubernetes .client .CustomResource ;
9+ import io .fabric8 .kubernetes .client .KubernetesClientException ;
910import io .fabric8 .kubernetes .client .dsl .MixedOperation ;
1011import io .fabric8 .kubernetes .client .dsl .Resource ;
1112import io .javaoperatorsdk .operator .api .Context ;
@@ -53,6 +54,13 @@ public void setEventSourceManager(EventSourceManager eventSourceManager) {
5354 public PostExecutionControl handleExecution (ExecutionScope <R > executionScope ) {
5455 try {
5556 return handleDispatch (executionScope );
57+ } catch (KubernetesClientException e ) {
58+ log .info (
59+ "Kubernetes exception {} {} during event processing, {} failed" ,
60+ e .getCode (),
61+ e .getMessage (),
62+ executionScope );
63+ return PostExecutionControl .exceptionDuringExecution (e );
5664 } catch (RuntimeException e ) {
5765 log .error ("Error during event processing {} failed." , executionScope , e );
5866 return PostExecutionControl .exceptionDuringExecution (e );
You can’t perform that action at this time.
0 commit comments