-
Notifications
You must be signed in to change notification settings - Fork 136
[backups] Fix malformed glob and split in template #1708
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
Conversation
## What this PR does
A malformed glob ("*" instead of "*.yaml") captured the .gitattributes
file and sent it to the templating engine. Using `split` instead of
`splitList` on a string returned a map instead of a list, so templating
broke on `mustLast`. This patch corrects the errors.
### Release note
```release-note
[backups] Fix template-breaking errors in the backup-controller Helm
chart.
```
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
Summary of ChangesHello @lllamnyp, 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 addresses critical templating errors within 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
|
WalkthroughTwo Helm template modifications to the backup-controller: narrowing the CRDs template glob pattern from all files to only YAML files, and replacing the split function with splitList for metrics port extraction during deployment rendering. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
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 selected for processing (2)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-11-27T11:21:45.808ZApplied to files:
🪛 YAMLlint (1.37.1)packages/system/backup-controller/templates/crds.yaml[error] 1-1: syntax error: expected the node content, but found '-' (syntax) ⏰ 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). (1)
🔇 Additional comments (2)
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 |
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 PR fixes two bugs in the Helm templates. The glob pattern for CRDs is correctly restricted to .yaml files, and splitList is used instead of split to correctly parse the port from the metrics address. The changes are valid. I've added a suggestion to further improve the robustness of the port extraction logic.
| ports: | ||
| - name: metrics | ||
| containerPort: {{ split ":" .Values.backupController.metrics.bindAddress | mustLast }} | ||
| containerPort: {{ splitList ":" .Values.backupController.metrics.bindAddress | mustLast }} |
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.
While changing split to splitList correctly handles cases like :8443, it introduces a potential issue. If backupController.metrics.bindAddress is set to a value without a port (e.g., an IP address like 127.0.0.1), mustLast will return the IP address itself, leading to an invalid containerPort and a failed deployment. The previous implementation with split would have failed during templating, which is generally safer.
A more robust and simpler approach would be to use a regular expression to extract the port number directly. This handles all cases correctly and fails gracefully by producing an empty (and thus invalid) port if one cannot be found.
containerPort: {{ .Values.backupController.metrics.bindAddress | regexFind "[0-9]+$" }}## What this PR does
A malformed glob ("*" instead of "*.yaml") captured the .gitattributes
file and sent it to the templating engine. Using `split` instead of
`splitList` on a string returned a map instead of a list, so templating
broke on `mustLast`. This patch corrects the errors.
### Release note
```release-note
[backups] Fix template-breaking errors in the backup-controller Helm
chart.
```
(cherry picked from commit 4f5ae28)
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
…d backup system (#1867) ## What this PR does Update changelog for v1.0.0-alpha.1 to include missing features: - **Cozystack Operator**: New operator for Package and PackageSource management (#1740, #1741, #1755, #1756, #1760, #1761) - **Backup System**: Comprehensive backup functionality with Velero integration (#1640, #1685, #1687, #1708, #1719, #1720, #1737, #1762) - Add @androndo to contributors - Update Full Changelog link to v0.38.0...v1.0.0-alpha.1 ### Release note ```release-note [docs] Update changelog for v1.0.0-alpha.1: add cozystack-operator and backup system ```
What this PR does
A malformed glob ("" instead of ".yaml") captured the .gitattributes file and sent it to the templating engine. Using
splitinstead ofsplitListon a string returned a map instead of a list, so templating broke onmustLast. This patch corrects the errors.Release note
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.