Skip to content

Commit 6c6bb29

Browse files
committed
fix: also record interfaces even if event source was previously created
1 parent bc86ec5 commit 6c6bb29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/AbstractEventSourceHolderDependentResource.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ public void stop() throws OperatorException {
2828
}
2929

3030
public EventSource initEventSource(EventSourceContext<P> context) {
31+
// some sub-classes (e.g. KubernetesDependentResource) can have their event source created
32+
// before this method is called in the managed case, so only create the event source if it
33+
// hasn't already been set
3134
if (eventSource == null) {
3235
eventSource = createEventSource(context);
33-
isFilteringEventSource = eventSource instanceof RecentOperationEventFilter;
34-
isCacheFillerEventSource = eventSource instanceof RecentOperationCacheFiller;
3536
}
37+
38+
// but we still need to record which interfaces the event source implements even if it has
39+
// already been set before this method is called
40+
isFilteringEventSource = eventSource instanceof RecentOperationEventFilter;
41+
isCacheFillerEventSource = eventSource instanceof RecentOperationCacheFiller;
3642
return this;
3743
}
3844

0 commit comments

Comments
 (0)