-
Notifications
You must be signed in to change notification settings - Fork 10
feat(base-cluster/alertmanager): add telegram receiver #1863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughAdds Telegram as a new Alertmanager receiver type: template now emits Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (4)📓 Common learnings📚 Learning: 2025-07-24T13:42:05.473ZApplied to files:
📚 Learning: 2025-07-21T14:04:07.149ZApplied to files:
📚 Learning: 2025-07-24T13:42:05.473ZApplied to files:
⏰ 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)
🔇 Additional comments (1)
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. Comment |
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml
Show resolved
Hide resolved
4ac50d9 to
3c5c9ee
Compare
cwrau
left a comment
There was a problem hiding this 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
3c5c9ee to
6fbfada
Compare
Done so. Can you check? |
6fbfada to
e9d583b
Compare
There was a problem hiding this 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
📒 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.yamlcharts/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.yamlcharts/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.yamlcharts/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
sendResolvedfield 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.
e9d583b to
6491e3c
Compare
3b76312 to
a7f3cbf
Compare
a7f3cbf to
479c5c4
Compare
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.