Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class ManagedInformerEventSource<R extends HasMetadata, P extend

@SuppressWarnings("rawtypes")
private static final ConcurrentMap<ResourceConfigurationAsKey, InformerManager> managedInformers =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, don't know what to think about this static context.
What is this magic number 17?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be started and stopped multiple times. Don't like the facts that it is even shared between the controllers. It will be started and stopped multiple times.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it would deserve a Integration test with multiple controllers and multiple informers each.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you're the one who wanted to share informers between sources… :)
We now avoid starting or stopping multiple times anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add integration test for this, like when 2 reconcilers added with 2 Informers, so there is only one informer in the background.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And checking that everything is propoerly triggered after resource updated.

new ConcurrentHashMap<>(17);
new ConcurrentHashMap<>();

protected ManagedInformerEventSource(
MixedOperation<R, KubernetesResourceList<R>, Resource<R>> client, C configuration) {
Expand Down Expand Up @@ -51,14 +51,18 @@ protected InformerManager<R, C> manager() {

@Override
public void start() {
manager().start();
super.start();
if(!isRunning()) {
manager().start();
super.start();
}
}

@Override
public void stop() {
super.stop();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the thread safety but probably ok this way

manager().stop();
if (isRunning()) {
super.stop();
manager().stop();
}
}

@SuppressWarnings("rawtypes")
Expand Down