Skip to content

Commit 15e74f8

Browse files
committed
improvements
1 parent 142fedc commit 15e74f8

File tree

1 file changed

+5
-1
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer

1 file changed

+5
-1
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.fabric8.kubernetes.api.model.HasMetadata;
1111
import io.fabric8.kubernetes.client.KubernetesClient;
1212
import io.fabric8.kubernetes.client.informers.ResourceEventHandler;
13+
import io.javaoperatorsdk.operator.OperatorException;
1314
import io.javaoperatorsdk.operator.api.config.ConfigurationService;
1415
import io.javaoperatorsdk.operator.api.config.informer.InformerConfiguration;
1516
import io.javaoperatorsdk.operator.api.reconciler.EventSourceContext;
@@ -346,13 +347,16 @@ private boolean acceptedByDeleteFilters(R resource, boolean b) {
346347
// ExecutorManagerService is actually injected after it is registered. Some of the subcomponents
347348
// are created that time here.
348349
public void setConfigurationService(ConfigurationService configurationService) {
350+
this.configurationService = configurationService;
349351
cache = new InformerManager<>(client, configuration, configurationService, this);
350352
cache.addIndexers(indexerBuffer);
351353
indexerBuffer = null;
352-
this.configurationService = configurationService;
353354
}
354355

355356
public void addIndexers(Map<String, Function<R, List<String>>> indexers) {
357+
if (indexerBuffer == null) {
358+
throw new OperatorException("Cannot add indexers after InformerEventSource started.");
359+
}
356360
indexerBuffer.putAll(indexers);
357361
}
358362

0 commit comments

Comments
 (0)