From 21ed9bbc0c9b2544f64308b08fc19e1689ba94ae Mon Sep 17 00:00:00 2001 From: Jake Keeys Date: Fri, 9 Feb 2024 14:22:04 +0000 Subject: [PATCH] default to alertmanager v2 api (#7123) Signed-off-by: Jake Keeys --- CHANGELOG.md | 2 ++ pkg/alert/config.go | 4 ++-- pkg/alert/config_test.go | 14 +++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 641fdabef2..ede881b983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ### Changed +- [#7123](https://github.com/thanos-io/thanos/pull/7123) Rule: Change default Alertmanager API version to v2. + ### Removed ## [v0.34.0](https://github.com/thanos-io/thanos/tree/release-0.34) - 26.01.24 diff --git a/pkg/alert/config.go b/pkg/alert/config.go index f509ccc993..8ad54dac89 100644 --- a/pkg/alert/config.go +++ b/pkg/alert/config.go @@ -67,7 +67,7 @@ func DefaultAlertmanagerConfig() AlertmanagerConfig { FileSDConfigs: []clientconfig.HTTPFileSDConfig{}, }, Timeout: model.Duration(time.Second * 10), - APIVersion: APIv1, + APIVersion: APIv2, } } @@ -136,7 +136,7 @@ func BuildAlertmanagerConfig(address string, timeout time.Duration) (Alertmanage StaticAddresses: []string{host}, }, Timeout: model.Duration(timeout), - APIVersion: APIv1, + APIVersion: APIv2, }, nil } diff --git a/pkg/alert/config_test.go b/pkg/alert/config_test.go index a0e259756c..5df9b88f06 100644 --- a/pkg/alert/config_test.go +++ b/pkg/alert/config_test.go @@ -58,7 +58,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { StaticAddresses: []string{"localhost:9093"}, Scheme: "http", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, { @@ -68,7 +68,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { StaticAddresses: []string{"am.example.com"}, Scheme: "https", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, { @@ -78,7 +78,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { StaticAddresses: []string{"dns+localhost:9093"}, Scheme: "http", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, { @@ -88,7 +88,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { StaticAddresses: []string{"dnssrv+localhost"}, Scheme: "http", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, { @@ -98,7 +98,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { StaticAddresses: []string{"localhost"}, Scheme: "ssh+http", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, { @@ -109,7 +109,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { Scheme: "https", PathPrefix: "/path/prefix/", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, { @@ -125,7 +125,7 @@ func TestBuildAlertmanagerConfiguration(t *testing.T) { StaticAddresses: []string{"localhost:9093"}, Scheme: "http", }, - APIVersion: APIv1, + APIVersion: APIv2, }, }, {