canonical / alertmanager-k8s-operator

https://charmhub.io/alertmanager-k8s
Apache License 2.0
5 stars 17 forks source link

Add an interface allowing sending Alertmanager's configuration through the relation #79

Closed Gmerold closed 4 months ago

Gmerold commented 2 years ago

Enhancement Proposal

Hello,

On behalf of the Telco team, I'd like to propose adding an interface similar to Prometheus's prometheus_remote_write, which would allow configuring the Alertmanager through the relation data. Main reason for this change is the fact, that Magma uses an external component, called alertmanager-configurer, to update Alertmanager with the configuration created via Magma NMS (GUI). Additionally, we believe that such change would add to the overall flexibility of the alertmanager-k8s charm.

From the implementation perspective, this would work just like in the Prometheus - consumer of the remote-write relation would push the config to the relation data bag and the charm would simply save this config to the alertmanager.yml file and reload the service.

Thanks in advance for looking into this and let the discussion begin.

BR, Bartek

sed-i commented 2 years ago

Thanks for the proposal, @Gmerold!

In the alertmanager charm we have intentionally avoided modeling the configuration file in the charm, and users are currently expected to provide the entire alertmanager configuration using two config option: config_file and templates_file.

Taking that information from relation data instead of a config option should not be too difficult, and would be somewhat analogous to the "config-builder" charms we already have, such as scrape-config and scrape-target. The proposed new relation could be another supported method for building alertmanager's configuration.

Some things to consider:

WDYT?

Gmerold commented 2 years ago

Thanks for replying Leon. In general, I agree with all your points.

As for the considerations you've mentioned:

sed-i commented 2 years ago

@balbirthomas @rbarry82 thoughts?

balbirthomas commented 2 years ago

Another special case may be worth considering. If Alertmanager exposes a relation interface that allows it to accept its entire configuration file and a set of notification templates is there also a need for conflict resolution or alternatively is only one such relation allowed ? I mean if two client charms are related to Alertmanager using this configuration relation interface that provides a config files, how should Alertmanger handle conflicts in two different configuration files ? More generally how should Alertmanager merge multiple configuration files (and notification templates) ? Note Prometheus charm does not support obtaining entire configuration file over relation data but only a very small subset i.e. "Static Scrape Jobs" and for this subset Prometheus ensures that Job names do not conflict.

lucabello commented 4 months ago

I think this is not relevant anymore, so closing; please feel free to reopen it though!