Skip to content

Conversation

@lllamnyp
Copy link
Member

@lllamnyp lllamnyp commented Dec 10, 2025

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

[backups] Fix template-breaking errors in the backup-controller Helm
chart.

Summary by CodeRabbit

  • Bug Fixes
    • Refined configuration file filtering to load only valid resource definitions, improving deployment reliability.
    • Enhanced metrics port extraction to ensure accurate port configuration during deployment.

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

## 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>
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Dec 10, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 backup-controller Helm chart. The changes rectify issues stemming from an overly permissive glob pattern that processed unintended files and an incorrect string splitting function that led to templating failures. By refining these configurations, the PR ensures the Helm chart deploys correctly and robustly, preventing potential deployment breakdowns related to malformed templates.

Highlights

  • Glob Pattern Correction: The glob pattern in crds.yaml was too broad (definitions/*), inadvertently capturing non-YAML files like .gitattributes. This has been corrected to definitions/*.yaml to ensure only YAML definition files are processed by the templating engine.
  • Templating Function Fix: The split function was incorrectly used in deployment.yaml to parse the bindAddress, which returned a map instead of a list, causing mustLast to fail. This has been fixed by replacing split with splitList, ensuring the correct data type for subsequent operations.
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

Walkthrough

Two 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

Cohort / File(s) Summary
CRDs Template Glob Pattern
packages/system/backup-controller/templates/crds.yaml
Changed Helm template file glob from definitions/* to definitions/*.yaml, restricting included resources to YAML files only
Deployment Port Extraction
packages/system/backup-controller/templates/deployment.yaml
Replaced split template function with splitList for extracting containerPort from metrics.bindAddress field

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that splitList produces functionally identical output to split for the metrics.bindAddress parsing
  • Confirm the YAML glob restriction doesn't inadvertently exclude required definition files
  • Test rendered manifests to ensure both changes produce expected output

Poem

A rabbit tends the helm with care, 🐰
YAML files now sorted true,
Split becomes splitList's pair,
Templates refined, clean and new!

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 title clearly and concisely summarizes the main changes: fixing a malformed glob pattern and split function issue in Helm templates for the backup controller.
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 fix/backup-controller-templating

📜 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 8513dd6 and 6b8c490.

📒 Files selected for processing (2)
  • packages/system/backup-controller/templates/crds.yaml (1 hunks)
  • packages/system/backup-controller/templates/deployment.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T11:21:45.808Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-27T11:21:45.808Z
Learning: Applies to **/Chart.yaml : Use Helm Charts with the umbrella pattern and vendor upstream charts in `charts/` directory

Applied to files:

  • packages/system/backup-controller/templates/crds.yaml
🪛 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)
  • GitHub Check: Build
🔇 Additional comments (2)
packages/system/backup-controller/templates/deployment.yaml (1)

40-40: Correct use of splitList for metrics port extraction.

The change from split to splitList is the correct fix. In Helm templating, split returns a map, while splitList returns a list. Since mustLast requires a list to extract the last element, splitList is the proper function to use here.

packages/system/backup-controller/templates/crds.yaml (1)

1-1: Glob pattern correctly narrowed to YAML files.

The change from definitions/* to definitions/*.yaml properly restricts the glob to YAML files only, preventing non-YAML artifacts (like .gitattributes) from being passed to the templating engine. This fixes the template-breaking error mentioned in the PR.

Note: The YAMLlint error is a false positive—YAML linters cannot parse Helm template syntax, which is pre-processed before YAML validation.

Please confirm that all necessary CRD files in the definitions/ directory use the .yaml extension (not .yml or other variants).


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.

@lllamnyp lllamnyp enabled auto-merge December 10, 2025 09:00
Copy link
Contributor

@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 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 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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]+$" }}

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 10, 2025
@lllamnyp lllamnyp merged commit 4f5ae28 into main Dec 10, 2025
27 checks passed
@lllamnyp lllamnyp deleted the fix/backup-controller-templating branch December 10, 2025 09:37
lllamnyp added a commit that referenced this pull request Jan 8, 2026
## 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>
kvaps added a commit that referenced this pull request Jan 16, 2026
…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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants