-
Notifications
You must be signed in to change notification settings - Fork 250
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
mimir.rules.kubernetes: Add support for clustered mode #669
Conversation
This change adds support for updating Mimir rules based on PrometheusRule objects when running in clustered mode. It does this by picking a single instance to be the leader responsible for making changes using the Mimir API. Other non-leader instances will not process events or make calls to the Mimir API. Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
Question for the maintainers: I find myself needing to do a fair amount of refactoring of this component in order to test the interesting bits of the clustering logic added to |
Nevermind, I've managed to make the logic from |
38cf1ca
to
06cf6ba
Compare
This commit introduces a few interfaces that cover some internal methods of the `Component`. This allows the interesting logic from `Component::Run()` to be extracted to its own method and tested with mocks of some portions of the rest of the `Component`. Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
06cf6ba
to
2d46f69
Compare
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
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.
Doc changes look OK
{{< admonition type="warning" >}} | ||
This component does not support [clustered mode][]. Using this component as part of a cluster of | ||
{{< param "PRODUCT_NAME" >}} instances will cause them to all attempt to update rules using the | ||
Mimir API, conflicting with each other. When using this component, it must be run in a separate | ||
single-instance deployment of {{< param "PRODUCT_NAME" >}}. | ||
|
||
[clustered mode]: ../../../concepts/clustering/ | ||
{{< /admonition >}} |
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.
IMO instead of removing this outright I think we should add a description for how the component does behave in clustered mode now. (Also noting that this behavior is only present starting with 1.1).
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
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.
LGTM, thanks for all the work you've put into this!
@clayton-cornell can you check the new docs changes before we merge?
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.
Minor rephrase and good to go
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
This change adds support for updating Mimir rules based on PrometheusRule objects when running in clustered mode. It does this by picking a single instance to be the leader responsible for making changes using the Mimir API. Other non-leader instances will not process events or make calls to the Mimir API. Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com> Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
PR Description
This change adds support for updating Mimir rules based on PrometheusRule objects when running in clustered mode. It does this by picking a single instance to be the leader responsible for making changes using the Mimir API. Other non-leader instances will not process events or make calls to the Mimir API.
Which issue(s) this PR fixes
Related: #158
Related: #616
Related: #648
Notes to the Reviewer
It might be helpful to review this by commit:
Component::Run()
could be unit tested.PR Checklist