Skip to content

api: add post_updates_to_thread to VMAlertmanagerConfig Slack receiver - #2580

Open
sebastien-glon-cko wants to merge 5 commits into
VictoriaMetrics:masterfrom
sebastien-glon-cko:vmalertmanagerconfig-slack-post-updates-to-thread
Open

sebastien-glon-cko wants to merge 5 commits into
VictoriaMetrics:masterfrom
sebastien-glon-cko:vmalertmanagerconfig-slack-post-updates-to-thread

Conversation

@sebastien-glon-cko

@sebastien-glon-cko sebastien-glon-cko commented Sep 3, 2026 •

Copy link
Copy Markdown

Describe Your Changes

Adds the upcoming alertmanager slack_configs option post_updates_to_thread to the VMAlertmanagerConfig Slack receiver, following the exact same pattern as update_message:

  • api/operator/v1beta1: new optional post_updates_to_thread (*bool) field on SlackConfig, plus regenerated deepcopy, CRDs and docs/api.md.
  • factory/vmalertmanager/config.go: render the key into the generated alertmanager configuration only when set.
  • Extended the existing Slack receiver test to cover the new field.

When enabled, alertmanager posts subsequent notifications for an alert group (resolved, repeats) as replies in the thread of the initial Slack message instead of new channel messages; combined with update_message, the initial message is updated in place and a reply is also posted to its thread.

Note: the upstream alertmanager feature prometheus/alertmanager#5540 has been merged (2026-09-29) and will ship in alertmanager v0.35.0. The key name post_updates_to_thread is unchanged from the merged version. The branch is rebased on current master.

Checklist

  • Implementation is added
  • Tests are added (go test ./internal/controller/operator/factory/vmalertmanager/... and api module tests pass)
  • Documentation is regenerated (make docs)
  • CHANGELOG entry added

🤖 Generated with Claude Code

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

Re-trigger cubic

@sebastien-glon-cko
sebastien-glon-cko force-pushed the vmalertmanagerconfig-slack-post-updates-to-thread branch from d51f1f0 to 5ebcc0f Compare October 30, 2026 08:26
sebastien-glon-cko added a commit to sebastien-glon-cko/operator that referenced this pull request Oct 30, 2026
@Haleygo

Haleygo commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Update: Alertmanager v0.35.0 has not been released yet, so no official release supports this new field.
I'm converting this PR to a draft now to better reflect its status. Please bump the vendored Alertmanager version once an official release is available upstream and convert this PR as ready for review again.

@Haleygo
Haleygo marked this pull request as draft November 3, 2026 06:09
@vrutkovs

vrutkovs commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Similar to other alertmanager PRs (#2707) we should introduce a version check and a manual override so that this option could not be used with Alertmanager which doesn't support it

@sebastien-glon-cko
sebastien-glon-cko force-pushed the vmalertmanagerconfig-slack-post-updates-to-thread branch from 5ebcc0f to e366235 Compare November 3, 2026 09:20
sebastien-glon-cko added a commit to sebastien-glon-cko/operator that referenced this pull request Nov 3, 2026
@sebastien-glon-cko

Copy link
Copy Markdown
Author

@vrutkovs Added in e366235: a VMAlertmanagerConfig setting post_updates_to_thread is now marked invalid for a VMAlertmanager whose spec.image.tag is below v0.35.0 (checked per VMAlertmanager, since a config can be selected by several). Non-semver tags are treated as supported, as in #2707, and VM_DISABLE_ALERTMANAGER_VERSION_CHECK=true skips the check for custom builds with a release-like tag. It's operator-wide, so #2707 could reuse it. I'll bump the Alertmanager version and mark the PR ready once v0.35.0 is released.

// 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"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PostUpdatesToThread *bool `json:"post_updates_to_thread,omitempty" yaml:"post_updates_to_thread,omitempty"`
// +notes={available_from: "v0.76.0"}
PostUpdatesToThread *bool `json:"post_updates_to_thread,omitempty" yaml:"post_updates_to_thread,omitempty"`

This would show implementation version in thje focs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3e36f23 (still in the rebased 056da57).

Comment thread internal/config/config.go Outdated
EnableDefaultPreStopHook bool `default:"true" env:"VM_ENABLE_DEFAULT_PRESTOP_HOOK"`
// Skips checks of the Alertmanager image tag against the minimal version required by configured features.
// Useful for custom builds with a release-like tag that already contain the required features.
DisableAlertmanagerVersionCheck bool `default:"false" env:"VM_DISABLE_ALERTMANAGER_VERSION_CHECK"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I pointed you to a different PR. Instead of fully disabling vmalertmanager version check, we'd rather have a way to skip this particular check

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

sebastien-glon-cko added a commit to sebastien-glon-cko/operator that referenced this pull request Nov 10, 2026
@sebastien-glon-cko
sebastien-glon-cko force-pushed the vmalertmanagerconfig-slack-post-updates-to-thread branch from 3e36f23 to 1c80468 Compare November 10, 2026 14:24
@sebastien-glon-cko
sebastien-glon-cko marked this pull request as ready for review November 10, 2026 14:24
@sebastien-glon-cko

Copy link
Copy Markdown
Author

@Haleygo Alertmanager v0.35.0 is out (2026-11-09). 1c80468 bumps the vendored module in go.mod and api/go.mod and the default VM_ALERTMANAGER_VERSION. v0.35.0 added EnableMutedAlertsInNflog to featurecontrol.Flagger (and dropped EnableAutoGOMAXPROCS), so the no-op flagger has been updated, with a compile-time interface assertion. I also rebased on master to fix the CHANGELOG conflict. make lint and the unit tests pass locally, and I checked that the v0.35.0 config parser accepts post_updates_to_thread. Marked ready for review.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 15 files

Re-trigger cubic

sebastien-glon-cko and others added 4 commits November 23, 2026 09:19
Exposes the upcoming alertmanager slack_configs option
post_updates_to_thread (prometheus/alertmanager#5540), which posts
subsequent notifications for an alert group as replies in the thread of
the initial Slack message. Follows the same pattern as update_message.
…than v0.35.0

A VMAlertmanagerConfig with slack_configs post_updates_to_thread is marked
invalid for a VMAlertmanager whose image tag is below v0.35.0, since older
releases fail to load a config with the unknown field. The check runs per
VMAlertmanager, as one VMAlertmanagerConfig may be selected by several.

Non-semver tags are treated as supported, and the check can be skipped for
custom builds with VM_DISABLE_ALERTMANAGER_VERSION_CHECK=true.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Sébastien GLON <[email protected]>
Replace the operator-wide VM_DISABLE_ALERTMANAGER_VERSION_CHECK with
VM_VMALERTMANAGER_SLACK_POST_UPDATES_TO_THREAD_SUPPORT, which only declares
support for this field, following the vmauth access_log.headers pattern.
Tags that are not a version are now treated as unsupported unless the flag
is set. Document the operator version the field is available from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Sébastien GLON <[email protected]>
v0.35.0 is the first release with slack_configs post_updates_to_thread
(prometheus/alertmanager#5540). Bump the vendored module in both go.mod
files and the default VM_ALERTMANAGER_VERSION.

featurecontrol.Flagger gained EnableMutedAlertsInNflog and dropped
EnableAutoGOMAXPROCS, so update the no-op flagger accordingly and add a
compile-time interface assertion.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Sébastien GLON <[email protected]>
@sebastien-glon-cko
sebastien-glon-cko force-pushed the vmalertmanagerconfig-slack-post-updates-to-thread branch from 1c80468 to 284747e Compare November 23, 2026 08:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants