Skip to content

Commit 7d007db

Browse files
committed
fix: if a stop handler is set, use it by default
1 parent 436fbf0 commit 7d007db

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,12 @@ default Optional<LeaderElectionConfiguration> getLeaderElectionConfiguration() {
164164
* if false, the startup will ignore recoverable errors, caused for example by RBAC issues, and
165165
* will try to reconnect periodically in the background.
166166
* </p>
167+
* <p>
168+
* NOTE: this setting is ignored if an informer stop handler is set
169+
* </p>
167170
*/
168171
default boolean stopOnInformerErrorDuringStartup() {
169-
return true;
172+
return getInformerStoppedHandler().isEmpty();
170173
}
171174

172175
/**

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverrider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ public Optional<InformerStoppedHandler> getInformerStoppedHandler() {
188188

189189
@Override
190190
public boolean stopOnInformerErrorDuringStartup() {
191-
return stopOnInformerErrorDuringStartup != null ? stopOnInformerErrorDuringStartup
191+
// only stop on informer error if we didn't set a stop handler for the informers
192+
return stopOnInformerErrorDuringStartup != null && informerStoppedHandler == null
193+
? stopOnInformerErrorDuringStartup
192194
: super.stopOnInformerErrorDuringStartup();
193195
}
194196

0 commit comments

Comments
 (0)