Skip to content

Fix: update Alertmanager secret config logic to validate Telegram bot token - #8465

Merged
simonpasquier merged 3 commits into
prometheus-operator:mainfrom
nutmos:feat/revise-bottoken-logic
Mar 26, 2026
Merged

simonpasquier merged 3 commits into
prometheus-operator:mainfrom
nutmos:feat/revise-bottoken-logic

Conversation

@nutmos

@nutmos nutmos commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR updates the logic to check bot_token and bot_token_file exists in the Alertmanager secret config.

Reason: Alertmanager >= 0.31.0 introduces the global configuration of telegram_bot_token and telegram_bot_token_file. Hence, the bot token is not required to be added in the receiver.

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Verification

Unit Testing

Changelog entry

Update Telegram bot token validation logic in Alertmanager secret config.

@nutmos nutmos changed the title alertmanager: remove alertmanager secret config logic to check bottoken Fix: remove Alertmanager secret config logic to check Telegram bot token Mar 26, 2026
@nutmos nutmos changed the title Fix: remove Alertmanager secret config logic to check Telegram bot token Fix: update Alertmanager secret config logic to validate Telegram bot token Mar 26, 2026
nutmos added 2 commits March 26, 2026 20:08
to ensure the logic is correctly implemented
@nutmos
nutmos marked this pull request as ready for review March 26, 2026 12:29
@nutmos
nutmos requested a review from a team as a code owner March 26, 2026 12:29
@nutmos

nutmos commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@simonpasquier Hi, could you please have a look at this PR?

@simonpasquier
simonpasquier merged commit ec55c44 into prometheus-operator:main Mar 26, 2026
22 checks passed
@simonpasquier

Copy link
Copy Markdown
Contributor

thanks!

Comment thread pkg/alertmanager/amcfg.go
tc.BotTokenFile = ""
}

if tc.BotToken == "" && tc.BotTokenFile == "" {

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.

Could you clarify why you changed the order of the conditions and moved this after the next one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nothing behind. My first intention was to remove the logic entirely before I did realize to keep this for older versions. Then, I added it back but in the different order than the original one, which I forgot to adjust it.

If this PR creates any issue, please let me know. I'm happy to fix it.

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, I haven’t seen any issues. I was just curious.

@nutmos
nutmos deleted the feat/revise-bottoken-logic branch April 18, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants