-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
How should I inject other dependencies into reconcilers? #102
Comments
🚂 🚋 🚋 <-- the dependency injection train At some point during the design of this framework, we had a discussion about dependency injection, and the upshot was that we were really hesitant about adding full-scale generic dependency injection, and decided to avoid it, and have a couple tightly scoped cases inside the library that didn't leak out (with the exception of My initial suggestion would just be to pass the logger in at object construction. If that's not possible for whatever reason, you could totally implement something similar to what we do internally -- things that need a |
Thanks for the background, I think the instinct to be wary of dependency injection is reasonable. Sounds like it's essentially an internal implementation detail. Since it's possible to call |
I think the goal of that was probably to allow users to not have to write constructors -- with the |
Is there a plan to allow the inject interfaces to inject arbitrary dependencies? Or maybe there's a better way to do this?
Concrete use case: I want reconcilers to have access to a logger instance, but it's not a
logr
logger so I can't use the log promise feature, and I'd like to avoid relying on package variables if possible. Also, I'd like each controller to have the same initialization signatureProvideController(manager.Manager, <something>)
(and I acknowledge this might be a silly requirement).@droot maybe you have some context on plans for inject.
The text was updated successfully, but these errors were encountered: