Skip to content

Conversation

@marvinWolff
Copy link
Collaborator

@marvinWolff marvinWolff commented Dec 5, 2025

Summary by CodeRabbit

  • New Features

    • Added Telegram as an Alertmanager receiver option (configurable bot token, chat ID, and send-resolved).
    • Values/schema updated to validate Telegram receiver settings alongside email and PagerDuty.
    • Included example CI values demonstrating multiple Telegram receiver configurations.
  • Chores

    • Bumped shared dependency version for the chart.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds Telegram as a new Alertmanager receiver type: template now emits telegram_configs for telegram receivers, Helm values schema accepts telegram receiver definitions (bottoken, chatid, sendResolved), a CI/example values file with Telegram receivers was added, and the chart dependency common was bumped to 1.7.0.

Changes

Cohort / File(s) Summary
Alertmanager template
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
Adds conditional branch to render telegram_configs (maps bottokenbot_token, chatidchat_id, sendResolvedsend_resolved) when receiver type is telegram.
Values schema
charts/base-cluster/values.schema.json
Adds patternProperties entry for `telegram($
CI/example values
charts/base-cluster/ci/telegram-values.yaml
New example/CI values file defining two telegram receivers (telegram, telegram 2) with bottoken and chatid test values.
Chart metadata
charts/base-cluster/Chart.yaml
Bumps dependency common chart version from 1.6.0 to 1.7.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify mapping from values keys (bottoken, chatid, sendResolved) to Alertmanager fields (bot_token, chat_id, send_resolved).
  • Confirm JSON Schema patternProperties regex and additionalProperties: false behavior with example receiver names.
  • Check Chart dependency bump for compatibility.

Possibly related PRs

Suggested reviewers

  • tasches
  • teutonet-bot

Poem

🐰 I nudged a bot token into line,
A chat id hopped on, feeling fine.
Alerts now bounce with telegram cheer,
Little hops of logs appear.
Hop, hop — delivery near.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(base-cluster/alertmanager): add telegram receiver' is directly related to and accurately summarizes the main change—adding Telegram receiver support to the Alertmanager configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/base-cluster/monitoring/add_telegram

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7f3cbf and 479c5c4.

⛔ Files ignored due to path filters (1)
  • charts/base-cluster/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • charts/base-cluster/Chart.yaml (1 hunks)
  • charts/base-cluster/ci/telegram-values.yaml (1 hunks)
  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml (1 hunks)
  • charts/base-cluster/values.schema.json (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • charts/base-cluster/Chart.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • charts/base-cluster/ci/telegram-values.yaml
  • charts/base-cluster/values.schema.json
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml, the receiver-type parsing logic that splits keys by space and only handles exactly two tokens is intentional and matches the schema design. The schema pattern `^email($| \S+$)` specifically allows "email" or "email <suffix>" format, not arbitrary multi-space patterns. The current parsing implementation correctly enforces this constraint.
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:50-61
Timestamp: 2025-07-21T14:04:07.149Z
Learning: In base-cluster alertmanager configuration, the schema only supports a single PagerDuty receiver (defined as `pagerduty` object), but supports multiple email receivers via pattern properties (e.g., "email", "email prod", "email staging"). Multiple PagerDuty receivers are not supported by design.
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster alertmanager receivers schema, email receiver keys follow the pattern `^email($| \\S+$)`, which allows only "email" or "email <suffix>" where suffix is `\S+` (no spaces allowed in suffix). The current parsing logic correctly enforces this by only handling exactly two tokens: the receiver type and the single non-whitespace suffix that becomes the receiver name.
📚 Learning: 2025-07-24T13:42:05.473Z
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml, the receiver-type parsing logic that splits keys by space and only handles exactly two tokens is intentional and matches the schema design. The schema pattern `^email($| \S+$)` specifically allows "email" or "email <suffix>" format, not arbitrary multi-space patterns. The current parsing implementation correctly enforces this constraint.

Applied to files:

  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
📚 Learning: 2025-07-21T14:04:07.149Z
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:50-61
Timestamp: 2025-07-21T14:04:07.149Z
Learning: In base-cluster alertmanager configuration, the schema only supports a single PagerDuty receiver (defined as `pagerduty` object), but supports multiple email receivers via pattern properties (e.g., "email", "email prod", "email staging"). Multiple PagerDuty receivers are not supported by design.

Applied to files:

  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
📚 Learning: 2025-07-24T13:42:05.473Z
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster alertmanager receivers schema, email receiver keys follow the pattern `^email($| \\S+$)`, which allows only "email" or "email <suffix>" where suffix is `\S+` (no spaces allowed in suffix). The current parsing logic correctly enforces this by only handling exactly two tokens: the receiver type and the single non-whitespace suffix that becomes the receiver name.

Applied to files:

  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: check licenses
  • GitHub Check: lint helm chart (base-cluster)
🔇 Additional comments (1)
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml (1)

86-96: LGTM! Telegram receiver implementation is correct and consistent.

The new telegram receiver block properly mirrors the existing email and pagerduty patterns:

  • Type parsing and receiver naming work correctly for both "telegram" and "telegram " variants
  • Field mappings (bottoken → bot_token, chatid → chat_id) align with Alertmanager's telegram configuration schema
  • The send_resolved default (false) matches the email receiver pattern

The security concern about plain-text token storage was already addressed in prior discussion: tokens are injected via valuesFrom (external secret reference) and Kube-prometheus-stack secures the generated config in a Kubernetes secret.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @marvinWolff, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the base-cluster Helm chart by integrating Telegram as a new notification channel for Alertmanager. This feature allows users to configure Alertmanager to send alerts directly to Telegram chats, providing an additional, widely-used communication method for critical notifications and improving the overall flexibility of the monitoring setup.

Highlights

  • Telegram Receiver Support: Introduced the capability to configure Telegram as a notification receiver for Alertmanager within the base-cluster Helm chart.
  • Alertmanager Configuration Update: Modified the _alertmanager-config.yaml template to dynamically generate Telegram receiver configurations, including bot_token, chat_id, and send_resolved.
  • Schema Definition: Updated values.schema.json to define the structure and validation rules for Telegram receiver parameters, ensuring bottoken and chatid are required.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a Telegram receiver for Alertmanager. The implementation is a good start, but I have identified a couple of areas for improvement. Firstly, there's a security concern with storing the bot token in plain text, and I've suggested a way to use Kubernetes secrets instead. Secondly, for better flexibility and consistency with other receiver types, I recommend a schema change to allow defining multiple Telegram receivers. My detailed comments are below.

@marvinWolff marvinWolff force-pushed the feat/base-cluster/monitoring/add_telegram branch from 4ac50d9 to 3c5c9ee Compare December 5, 2025 13:21
Copy link
Member

@cwrau cwrau left a comment

Choose a reason for hiding this comment

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

You should add a CI test values file for this

@marvinWolff marvinWolff force-pushed the feat/base-cluster/monitoring/add_telegram branch from 3c5c9ee to 6fbfada Compare December 8, 2025 14:53
@marvinWolff
Copy link
Collaborator Author

You should add a CI test values file for this

Done so.

Can you check?

@marvinWolff marvinWolff force-pushed the feat/base-cluster/monitoring/add_telegram branch from 6fbfada to e9d583b Compare December 9, 2025 09:10
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fbfada and e9d583b.

📒 Files selected for processing (3)
  • charts/base-cluster/ci/telegram-values.yaml (1 hunks)
  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml (1 hunks)
  • charts/base-cluster/values.schema.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/base-cluster/ci/telegram-values.yaml
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml, the receiver-type parsing logic that splits keys by space and only handles exactly two tokens is intentional and matches the schema design. The schema pattern `^email($| \S+$)` specifically allows "email" or "email <suffix>" format, not arbitrary multi-space patterns. The current parsing implementation correctly enforces this constraint.
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:50-61
Timestamp: 2025-07-21T14:04:07.149Z
Learning: In base-cluster alertmanager configuration, the schema only supports a single PagerDuty receiver (defined as `pagerduty` object), but supports multiple email receivers via pattern properties (e.g., "email", "email prod", "email staging"). Multiple PagerDuty receivers are not supported by design.
📚 Learning: 2025-07-24T13:42:05.473Z
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml, the receiver-type parsing logic that splits keys by space and only handles exactly two tokens is intentional and matches the schema design. The schema pattern `^email($| \S+$)` specifically allows "email" or "email <suffix>" format, not arbitrary multi-space patterns. The current parsing implementation correctly enforces this constraint.

Applied to files:

  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
  • charts/base-cluster/values.schema.json
📚 Learning: 2025-07-24T13:42:05.473Z
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:55-61
Timestamp: 2025-07-24T13:42:05.473Z
Learning: In charts/base-cluster alertmanager receivers schema, email receiver keys follow the pattern `^email($| \\S+$)`, which allows only "email" or "email <suffix>" where suffix is `\S+` (no spaces allowed in suffix). The current parsing logic correctly enforces this by only handling exactly two tokens: the receiver type and the single non-whitespace suffix that becomes the receiver name.

Applied to files:

  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
  • charts/base-cluster/values.schema.json
📚 Learning: 2025-07-21T14:04:07.149Z
Learnt from: cwrau
Repo: teutonet/teutonet-helm-charts PR: 1600
File: charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml:50-61
Timestamp: 2025-07-21T14:04:07.149Z
Learning: In base-cluster alertmanager configuration, the schema only supports a single PagerDuty receiver (defined as `pagerduty` object), but supports multiple email receivers via pattern properties (e.g., "email", "email prod", "email staging"). Multiple PagerDuty receivers are not supported by design.

Applied to files:

  • charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
  • charts/base-cluster/values.schema.json
🔇 Additional comments (2)
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml (1)

86-96: Telegram receiver handler looks solid.

The implementation correctly mirrors the email receiver pattern, properly parses the receiver name and config, and maps fields to Alertmanager's telegram_configs format. The optional sendResolved field defaults to false as expected.

charts/base-cluster/values.schema.json (1)

556-615: Schema definition aligns with template and email pattern.

The patternProperties entry correctly mirrors the email receiver structure, enabling multiple telegram receivers with optional suffixes (e.g., "telegram", "telegram team-a"). Required fields, property types, and additionalProperties constraints match the implementation. Based on learnings, this pattern-based approach is consistent with the receiver-type parsing logic.

@cwrau cwrau force-pushed the feat/base-cluster/monitoring/add_telegram branch from e9d583b to 6491e3c Compare December 9, 2025 09:14
@cwrau cwrau requested a review from a team as a code owner December 9, 2025 09:14
@marvinWolff marvinWolff force-pushed the feat/base-cluster/monitoring/add_telegram branch 3 times, most recently from 3b76312 to a7f3cbf Compare December 9, 2025 09:28
@marvinWolff marvinWolff force-pushed the feat/base-cluster/monitoring/add_telegram branch from a7f3cbf to 479c5c4 Compare December 9, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants