Skip to content

Commit 235fa24

Browse files
committed
fix: if a watch closes and fails to reconnect, exit the operator
1 parent 112a826 commit 235fa24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ public void onClose(WatcherException e) {
154154
}
155155
if (e.isHttpGone()) {
156156
log.warn("Received error for watch, will try to reconnect.", e);
157-
registerWatch();
157+
try {
158+
registerWatch();
159+
} catch (Throwable ex) {
160+
log.error("Unexpected error happened with watch. Will exit.", e);
161+
System.exit(1);
162+
}
158163
} else {
159164
// Note that this should not happen normally, since fabric8 client handles reconnect.
160165
// In case it tries to reconnect this method is not called.

0 commit comments

Comments
 (0)