From e52cc91964181badf55daca73b39c674973308ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 11 Jun 2020 19:28:19 +0100 Subject: [PATCH] feat(config): add cluster option to alertmanager instances --- internal/config/config.go | 1 + internal/config/config_test.go | 3 ++- internal/config/models.go | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/config/config.go b/internal/config/config.go index 747b3ea99..b9b21a396 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -358,6 +358,7 @@ func (config *configSchema) LogValues() { servers := []AlertmanagerConfig{} for _, s := range cfg.Alertmanager.Servers { server := AlertmanagerConfig{ + Cluster: s.Cluster, Name: s.Name, URI: uri.SanitizeURI(s.URI), ExternalURI: uri.SanitizeURI(s.ExternalURI), diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 0d7581fa7..10f81b64e 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -33,7 +33,8 @@ authorization: alertmanager: interval: 1s servers: - - name: default + - cluster: "" + name: default uri: http://localhost external_uri: http://example.com timeout: 40s diff --git a/internal/config/models.go b/internal/config/models.go index 367ed309e..b2abb47bd 100644 --- a/internal/config/models.go +++ b/internal/config/models.go @@ -10,6 +10,7 @@ type AlertmanagerCORS struct { } type AlertmanagerConfig struct { + Cluster string Name string URI string ExternalURI string `yaml:"external_uri" koanf:"external_uri"` @@ -70,6 +71,7 @@ type configSchema struct { Alertmanager struct { Interval time.Duration Servers []AlertmanagerConfig + Cluster string `yaml:"-" koanf:"cluster"` Name string `yaml:"-" koanf:"name"` Timeout time.Duration `yaml:"-" koanf:"timeout"` URI string `yaml:"-" koanf:"uri"`