-
Notifications
You must be signed in to change notification settings - Fork 3
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
generic coordinator and worker classes #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like where this is going. A bit of comments from me but it looks like migration might be pretty straightforward, nice :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I managed to do only a partial review for now.
Should we split out databag_model
to a tandem PR? Perhaps taking it outside of this context would help with abstractions?
I answered all the comments so far, and closed a bunch I agreed with and solved :) As per the |
given it brings quite a bunch of controversy and noise to this PR, I agree we should probably keep ti separate and make this branch depend on that one. |
I've moved We should absolutely make a shared databag abstraction to re-use in our charms, but (even though the code is still there) I'm taking the file out of the PR so we don't waste time on that for now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I posted a few comments in the code.
On a more general note I think we should try to avoid as much as we can the coupling between Coordinator
and Worker
and its collaborators objects.
For instance, JujuTopology
, CertHandler
, MetricsEndpointProvider
, etc are instantiated in the __init__
of the classes.
What do you think about injecting those dependencies instead of creating the instances inside the objects?
I know for that we may need some factory methods/classes... but by reducing the coupling we increase testability and separation of concerns.
@Abuelodelanada the “coupling” is 50% of the work here, and it's a feature: the coordinator/workers class are meant to abstract two main things
If we were to pass objects like Of course, there is room for improvement:
However, the points above would require discussions, careful design, and that's something I'd love to do — but I don't think we have time for that right now, and we'll have to postpone those. |
@lucabello do we have a tandem PR for this somewhere? |
I have linked the two Mimir PRs where this abstraction is used. If we don't have other comments, we need to address a few last things:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Thanks for being patient with all the comments :)
Let's see how it goes using it in a charm!
Issue
Our work on HA solutions (Mimir, Loki, and Tempo) is rapidly becoming more complex, making it easy for the respective Coordinator/Worker charms to diverge.
Solution
Most of the Coordinator/Worker charms are in fact shared between the different HA solutions; this PR adds abstractions to simplify the creation and management of Coordinator/Worker charms, also preventing the charms from diverging.
Testing Instructions
To test these classes, we should use them in our Mimir HA deployment, and make sure the solution still functions.
Mimir PR: (to be added)
Additional Context