Skip to content

Commit 1b11546

Browse files
authored
feature!: throw exception if controller cannot be registered (#641)
* feature!: throw exception if controller cannot be registered If a controller cannot be registered because of cofirguration loading is a programatic error, should be reported asap. Logging just a warning would make it hard to find out where is the problem and why the controller not starting
1 parent 1bb920c commit 1b11546

File tree

1 file changed

+5
-6
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator

1 file changed

+5
-6
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/Operator.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,11 @@ public void close() {
137137
throws OperatorException {
138138
final var existing = configurationService.getConfigurationFor(controller);
139139
if (existing == null) {
140-
log.warn(
141-
"Skipping registration of {} controller named {} because its configuration cannot be found.\n"
142-
+ "Known controllers are: {}",
143-
controller.getClass().getCanonicalName(),
144-
ControllerUtils.getNameFor(controller),
145-
configurationService.getKnownControllerNames());
140+
throw new OperatorException(
141+
"Cannot register controller with name " + controller.getClass().getCanonicalName() +
142+
" controller named " + ControllerUtils.getNameFor(controller)
143+
+ " because its configuration cannot be found.\n" +
144+
" Known controllers are: " + configurationService.getKnownControllerNames());
146145
} else {
147146
if (configuration == null) {
148147
configuration = existing;

0 commit comments

Comments
 (0)