Skip to content

fix: add StoreBuilder to mimir.alerts.kubernetes eventProcessor#5010

Merged
ptodev merged 4 commits intografana:mainfrom
synthe102:main
Dec 9, 2025
Merged

fix: add StoreBuilder to mimir.alerts.kubernetes eventProcessor#5010
ptodev merged 4 commits intografana:mainfrom
synthe102:main

Conversation

@synthe102
Copy link
Contributor

PR Description

Which issue(s) this PR fixes

Fixes #4975

Notes to the Reviewer

Add an assets.StoreBuilder to the eventProcessor so it can be passed to provisionAlertmanagerConfiguration that needs to fetch k8s secrets and configmaps in order to populate Alertmanager configs.

PR Checklist

@synthe102 synthe102 requested a review from a team as a code owner December 4, 2025 22:03
@CLAassistant
Copy link

CLAassistant commented Dec 4, 2025

CLA assistant check
All committers have signed the CLA.

@ptodev
Copy link
Contributor

ptodev commented Dec 9, 2025

@synthe102 thank you! I added some integration and unit tests to your branch.

@synthe102
Copy link
Contributor Author

Thanks @ptodev !

@ptodev
Copy link
Contributor

ptodev commented Dec 9, 2025

@synthe102 I added an entry to the changelog and tagged you, I hope you don't mind.

@ptodev
Copy link
Contributor

ptodev commented Dec 9, 2025

@synthe102 Do you mind rebasing your branch please?

@artemlive
Copy link

I've tested this, and there is another logical error. It's not directly related to the issue, but maybe it makes sense to fix it here.
When the config of the Alertmanager got generated, since we don't use the Alertmanager CRD, we built it with the defaults:

// TODO: Add an option to get an Alertmanager CRD through k8s informers.
cfgBuilder = alertmanager.NewConfigBuilder(slog.New(logging.NewSlogGoKitHandler(c.logger)), *version, store, &monitoringv1.Alertmanager{})
)

And it breaks the config, since it implicitly adds the

    matchers:
    - namespace="mimir"

to the main route:

...
 routes:
  - receiver: mimir/alertmanager-config/sre-alerts
    group_by:
    - alertname
    - cluster
    matchers:
    - namespace="mimir" #<---- the issue, since we care only about the alerts from the mimir ns
    continue: true
        routes:
          - receiver: mimir/alertmanager-config/other-alerts
            matchers:
            - cluster="staging"
            - project="project1"
            continue: false
            repeat_interval: 12h
...

Because we don't use the Alertmanager CRD, where we can set the alertmanagerConfigMatcherStrategy.
If you think it's unrelated, I can create a new issue.
Thanks.

@ptodev
Copy link
Contributor

ptodev commented Dec 9, 2025

Hi @artemlive, do you mind opening another issue for this please?

@artemlive
Copy link

artemlive commented Dec 9, 2025

@ptodev sure thing
I've created the new issue.

@ptodev ptodev merged commit 9052910 into grafana:main Dec 9, 2025
39 of 40 checks passed
dehaansa pushed a commit to iamrajiv/alloy that referenced this pull request Dec 10, 2025
…ana#5010)

* fix: add StoreBuilder to mimir.alerts.kubernetes eventProcessor

Fixes grafana#4975

* Add integration and unit tests

* Fix lint error

* Add changelog entry

---------

Co-authored-by: Paulin Todev <paulin.todev@gmail.com>
dehaansa pushed a commit to madhub/alloy that referenced this pull request Dec 10, 2025
…ana#5010)

* fix: add StoreBuilder to mimir.alerts.kubernetes eventProcessor

Fixes grafana#4975

* Add integration and unit tests

* Fix lint error

* Add changelog entry

---------

Co-authored-by: Paulin Todev <paulin.todev@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIGSEGV with mimir.alerts.kubernetes and AlertmanagerConfigs with slack config

5 participants