Skip to content

ConfiguredController behavior #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lburgazzoli opened this issue Sep 22, 2021 · 1 comment · Fixed by #562
Closed

ConfiguredController behavior #554

lburgazzoli opened this issue Sep 22, 2021 · 1 comment · Fixed by #562
Assignees

Comments

@lburgazzoli
Copy link
Collaborator

I see that the ConfiguredController has an init method in which does:

@Override
public void init(EventSourceManager eventSourceManager) {
  this.manager = eventSourceManager;
  controller.init(eventSourceManager);
}

So the underlying controller is initialized with the manager that is passed as an argument. But then the start method does something similar:

try {
  DefaultEventSourceManager<R> eventSourceManager = new DefaultEventSourceManager<>(this);
  controller.init(eventSourceManager);
} catch (MissingCRDException e) {
  throwMissingCRDException(crdName, specVersion, controllerName);
}

Wonder if this is correct or if this lead the controller to be initialized with two different event source manager.

@metacosm
Copy link
Collaborator

I don't really like this method, to be honest. It feels like abstraction leaking out. That said, there shouldn't be an issue because the init method is only called internally as a way to pass the EventSourceManager implementation to the controller implementations so that they can register their EventSource implementations and ConfiguredController.init should actually never be called. Maybe we could replace that implementation by throw new UnsupportedOperationException or something like that to make it clearer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants