-
Notifications
You must be signed in to change notification settings - Fork 486
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
Refactor mimir.rules.kubernetes component #6798
Conversation
c0aefe0
to
2cc0f46
Compare
loki.rules.kubernetes is very similar to the mimir.rules.kubernetes component. Would it make sense to do the same changes for the loki component in this PR and keep the similarities between the two implementations? Or should it be done via a following PR? |
Good point! My preference would be to:
|
Sounds good, would you mind creating an issue to track it and link it to this PR please? |
2cc0f46
to
71d019c
Compare
Done in grafana/alloy#194 |
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
This change refactors the `mimir.rules.kubernetes` component to move most mutable state into a separate `eventProcessor` struct. The existing code already split most behavior between the main `rules.go` file and `events.go` file. This takes the next logical step and wraps the state from `events.go` into its own struct. This is a prerequisite for a future PR that will add clustering support to the `mimir.rules.kubernetes` component. In the future PR a particular agent instance will be the "leader" for syncing rules from Mimir or not. When not the leader, the `eventProcesor` will be a no-op. Signed-off-by: Nick Pillitteri <[email protected]>
Signed-off-by: Nick Pillitteri <[email protected]>
39d7ee9
to
564e057
Compare
1c0b176
to
564e057
Compare
I moved this PR to Alloy: grafana/alloy#158 |
PR Description
This change refactors the
mimir.rules.kubernetes
component to move most mutable state into a separateeventProcessor
struct. The existing code already split most behavior between the mainrules.go
file andevents.go
file. This takes the next logical step and wraps the state fromevents.go
into its own struct.This is a prerequisite for a future PR that will add clustering support to the
mimir.rules.kubernetes
component. In the future PR a particular agent instance will be the "leader" for syncing rules from Mimir or not. When not the leader, theeventProcesor
will be a no-op.Which issue(s) this PR fixes
N/A
Notes to the Reviewer
As discussed offline, this change and the future PR to add clustering support is a stop-gap until there's some sort of universal clustered mode support for all components.
This has been tested with existing unit tests and locally by running Agents and Mimir in a k3s cluster via the Helm chart.
PR Checklist