Skip to content

[nats] Merge container spec, not podTemplate - #1571

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix/nats-container-merge
Nov 3, 2025
Merged

Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix/nats-container-merge

Conversation

@lllamnyp

@lllamnyp Timofei Larkin (lllamnyp) commented Nov 3, 2025 •

Copy link
Copy Markdown
Member

What this PR does

The NATS chart incorrectly used podTemplate+merge instead of container+merge to add resource requests and limits to the NATS container in the statefulset, but as a result it just completely wiped out the default container spec. By moving the overrides under the container key, the upstream chart now correctly merges the resource requests, instead of overwriting the container spec.

Release note

[nats] Fix incorrect path to container resources in the NATS chart.

Summary by CodeRabbit

  • Chores
    • Restructured NATS deployment configuration while maintaining existing functionality and resource settings; templates were reorganized to streamline how container and resource definitions are represented. No functional or behavioral changes are expected for deployments.

@dosubot dosubot Bot added the size/XS This PR changes 0-9 lines, ignoring generated files label Nov 3, 2025
@coderabbitai

coderabbitai Bot commented Nov 3, 2025 •

Copy link
Copy Markdown
Contributor

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

The NATS Helm template was restructured: container configuration moved from podTemplate.spec.containers.nats to a container.merge path, relocating image and resources definitions under the new nesting and adjusting indentation.

Changes

Cohort / File(s) Summary
Template restructure
packages/apps/nats/templates/nats.yaml
Replaces podTemplate.spec.containers.nats with container.merge, moving the image (nats:2.10.17-alpine) and resources into container.merge and adjusting template indentation/paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single-file YAML structural change; review should focus on correct Helm templating paths and that required container fields (name, image) remain available after the merge.
  • Files/areas to inspect closely:
    • packages/apps/nats/templates/nats.yaml — ensure resulting rendered pod spec contains expected container name, image, and resources.
    • Any values or charts that reference the previous podTemplate.spec.containers.nats path.

Possibly related issues

Poem

A rabbit hops through YAML lines,
Merging containers, shifting signs,
Image tucked in a new embrace,
Resources find their proper place.
🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title '[nats] Merge container spec, not podTemplate' directly and clearly summarizes the main change. It specifies the component (nats), the primary action (merge container spec), and contrasts it with the previous incorrect approach (not podTemplate). The title is concise, specific, and immediately conveys the core fix to anyone reviewing the PR history.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/nats-container-merge

📜 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 fe4718f and 8b95db0.

📒 Files selected for processing (1)
  • packages/apps/nats/templates/nats.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/apps/nats/templates/nats.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). (1)
  • GitHub Check: Build

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
Copy Markdown
Contributor

Summary of Changes

Hello Timofei Larkin (@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 resolves a critical configuration issue within the NATS Helm chart where resource specifications were being applied incorrectly, leading to the complete loss of default container settings. By adjusting the merge strategy from podTemplate to container, the change ensures that resource requests and limits are now properly merged into the NATS container's definition, enhancing the robustness and configurability of the deployment.

Highlights

  • NATS Chart Configuration Fix: The NATS Helm chart previously used podTemplate+merge which incorrectly overwrote the entire default container specification when applying resource requests and limits.
  • Corrected Merge Strategy: The pull request changes the merge key to container+merge, ensuring that resource overrides are correctly applied to the NATS container without wiping out its default configuration.
  • Resource Application: This change allows resource requests and limits to be properly integrated into the NATS container's specification, as intended.
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 (@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 (@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. ↩

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot Bot added lgtm This PR has been approved by a maintainer kind/bug Categorizes issue or PR as related to a bug labels Nov 3, 2025

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

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.

Code Review

This pull request correctly fixes an issue in the NATS Helm chart where resource overrides were incorrectly wiping out the entire container spec. By changing the merge target from podTemplate to container, the resource requests and limits are now correctly merged. This is a good fix. I have one suggestion to improve the change further by removing a redundant and potentially problematic image override, letting the upstream chart manage its version.

Comment thread packages/apps/nats/templates/nats.yaml Outdated
Comment on lines +52 to +53
image: nats:2.10.17-alpine
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 12 }}

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.

high

While fixing the merge strategy is correct, explicitly setting the image here is redundant and potentially incorrect. The upstream cozy-nats chart already defaults to nats:2.10.17-alpine. More importantly, the upstream chart's values expect image to be an object with repository and tag keys, but here it's being set as a simple string. This will likely cause template rendering errors.

It's best to remove the image line and let the upstream chart manage the image version. This makes the wrapper chart more maintainable.

          resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 12 }}

@kvaps Andrei Kvapil (kvaps) added the kind/backport Categorizes issue or PR as requiring a backport to the current release line label Nov 3, 2025
## What this PR does

The NATS chart incorrectly used podTemplate+merge instead of
container+merge to add resource requests and limits to the NATS
container in the statefulset, but as a result it just completely wiped
out the default container spec. By moving the overrides under the
container key, the upstream chart now correctly merges the resource
requests, instead of overwriting the container spec.

### Release note

```release-note
[nats] Fix incorrect path to container resources in the NATS chart.
```

Signed-off-by: Timofei Larkin <[email protected]>
@kvaps
Andrei Kvapil (kvaps) merged commit b78d97f into main Nov 3, 2025
22 checks passed
@kvaps
Andrei Kvapil (kvaps) deleted the fix/nats-container-merge branch November 3, 2025 10:33
@github-actions

github-actions Bot commented Nov 3, 2025

Copy link
Copy Markdown

Successfully created backport PR for release-0.37:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/bug Categorizes issue or PR as related to a bug 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.

2 participants