diff --git a/api/operator/v1beta1/vmalertmanagerconfig_types.go b/api/operator/v1beta1/vmalertmanagerconfig_types.go
index c253255b73..433e5df742 100644
--- a/api/operator/v1beta1/vmalertmanagerconfig_types.go
+++ b/api/operator/v1beta1/vmalertmanagerconfig_types.go
@@ -900,6 +900,14 @@ type SlackConfig struct {
// Available since alertmanager v0.32.0.
// +optional
UpdateMessage *bool `json:"update_message,omitempty" yaml:"update_message,omitempty"`
+ // Whether to post subsequent notifications for an alert group as replies
+ // in the thread of the initial message, instead of new channel messages.
+ // Can be combined with update_message to update the initial message in-place
+ // and also post a reply to its thread.
+ // Requires Slack Bot API and chat:write scope.
+ // Available since alertmanager v0.35.0.
+ // +optional
+ PostUpdatesToThread *bool `json:"post_updates_to_thread,omitempty" yaml:"post_updates_to_thread,omitempty"`
// HTTP client configuration.
// +optional
HTTPConfig *HTTPConfig `json:"http_config,omitempty" yaml:"http_config,omitempty"`
diff --git a/api/operator/v1beta1/zz_generated.deepcopy.go b/api/operator/v1beta1/zz_generated.deepcopy.go
index cbd6afb1e9..03e0571503 100644
--- a/api/operator/v1beta1/zz_generated.deepcopy.go
+++ b/api/operator/v1beta1/zz_generated.deepcopy.go
@@ -3780,6 +3780,11 @@ func (in *SlackConfig) DeepCopyInto(out *SlackConfig) {
*out = new(bool)
**out = **in
}
+ if in.PostUpdatesToThread != nil {
+ in, out := &in.PostUpdatesToThread, &out.PostUpdatesToThread
+ *out = new(bool)
+ **out = **in
+ }
if in.HTTPConfig != nil {
in, out := &in.HTTPConfig, &out.HTTPConfig
*out = new(HTTPConfig)
diff --git a/config/crd/overlay/crd.descriptionless.yaml b/config/crd/overlay/crd.descriptionless.yaml
index db5dfddfe9..fd0f5b7548 100644
--- a/config/crd/overlay/crd.descriptionless.yaml
+++ b/config/crd/overlay/crd.descriptionless.yaml
@@ -14181,6 +14181,8 @@ spec:
items:
type: string
type: array
+ post_updates_to_thread:
+ type: boolean
pretext:
type: string
send_resolved:
diff --git a/config/crd/overlay/crd.yaml b/config/crd/overlay/crd.yaml
index d50469088b..7d2fc0a031 100644
--- a/config/crd/overlay/crd.yaml
+++ b/config/crd/overlay/crd.yaml
@@ -28301,6 +28301,15 @@ spec:
items:
type: string
type: array
+ post_updates_to_thread:
+ description: |-
+ Whether to post subsequent notifications for an alert group as replies
+ in the thread of the initial message, instead of new channel messages.
+ Can be combined with update_message to update the initial message in-place
+ and also post a reply to its thread.
+ Requires Slack Bot API and chat:write scope.
+ Available since alertmanager v0.35.0.
+ type: boolean
pretext:
type: string
send_resolved:
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index c0f22c94ab..1665707264 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,8 @@ aliases:
## tip
+* FEATURE: [vmalertmanagerconfig](https://docs.victoriametrics.com/operator/resources/vmalertmanagerconfig/): add `post_updates_to_thread` field to `SlackConfig`. This allows alertmanager to post subsequent notifications for an alert group as replies in the thread of the initial Slack message; combined with `update_message`, the initial message is updated in-place and a reply is also posted to its thread. Requires alertmanager with [prometheus/alertmanager#5540](https://github.com/prometheus/alertmanager/pull/5540) (targeting v0.35.0). See [#2580](https://github.com/VictoriaMetrics/operator/pull/2580).
+
* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VM apps to [v1.151.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.151.0) version
* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VMAnomaly to [v1.30.4](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1304) version
* Dependency: [vmoperator](https://docs.victoriametrics.com/operator/): Updated default versions for VT apps to [v0.11.0](https://github.com/VictoriaMetrics/VictoriaTraces/releases/tag/v0.11.0) version
diff --git a/docs/api.md b/docs/api.md
index 5e1002b3fc..8dd797261d 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -3772,6 +3772,7 @@ Appears in: [Receiver (v1beta1)](#v1beta1-receiver)
| image_url#
_string_ | _(Optional)_
|
| link_names#
_boolean_ | _(Optional)_
|
| mrkdwn_in#
_string array_ | _(Optional)_
|
+| post_updates_to_thread#
_boolean_ | _(Optional)_
Whether to post subsequent notifications for an alert group as replies
in the thread of the initial message, instead of new channel messages.
Can be combined with update_message to update the initial message in-place
and also post a reply to its thread.
Requires Slack Bot API and chat:write scope.
Available since alertmanager v0.35.0. |
| pretext#
_string_ | _(Optional)_
|
| send_resolved#
_boolean_ | _(Optional)_
SendResolved controls notify about resolved alerts. |
| short_fields#
_boolean_ | _(Optional)_
|
diff --git a/internal/controller/operator/factory/vmalertmanager/config.go b/internal/controller/operator/factory/vmalertmanager/config.go
index f05aefe72d..bbc1237aa2 100644
--- a/internal/controller/operator/factory/vmalertmanager/config.go
+++ b/internal/controller/operator/factory/vmalertmanager/config.go
@@ -972,6 +972,9 @@ func buildSlack(gc *globalConfig, rc vmv1beta1.SlackConfig, ns string, ac *build
if rc.UpdateMessage != nil {
r.set("update_message", rc.UpdateMessage)
}
+ if rc.PostUpdatesToThread != nil {
+ r.set("post_updates_to_thread", rc.PostUpdatesToThread)
+ }
r.set("mrkdwn_in", rc.MrkdwnIn)
var actions []yaml.MapSlice
for _, action := range rc.Actions {
diff --git a/internal/controller/operator/factory/vmalertmanager/config_test.go b/internal/controller/operator/factory/vmalertmanager/config_test.go
index 8b272056c4..a1c9393728 100644
--- a/internal/controller/operator/factory/vmalertmanager/config_test.go
+++ b/internal/controller/operator/factory/vmalertmanager/config_test.go
@@ -759,14 +759,15 @@ templates: []
Name: "slack",
},
},
- SendResolved: ptr.To(true),
- UpdateMessage: ptr.To(true),
- Text: "some-text",
- Title: "some-title",
- LinkNames: false,
- ThumbURL: "some-url",
- Pretext: "text-1",
- Username: "some-user",
+ SendResolved: ptr.To(true),
+ UpdateMessage: ptr.To(true),
+ PostUpdatesToThread: ptr.To(true),
+ Text: "some-text",
+ Title: "some-title",
+ LinkNames: false,
+ ThumbURL: "some-url",
+ Pretext: "text-1",
+ Username: "some-user",
Actions: []vmv1beta1.SlackAction{
{
Name: "deny",
@@ -827,6 +828,7 @@ receivers:
title: some-title
thumb_url: some-url
update_message: true
+ post_updates_to_thread: true
actions:
- name: deny
text: text-5