Skip to content

Conversation

younsl
Copy link

@younsl younsl commented Aug 24, 2025

Changes

  • Add support spec.containers.resizePolicy field in deployment. This feature allows CPU and memory resources to be modified without pod restart or replacement.
  • Bump patch chart version

Reference

Summary by CodeRabbit

  • New Features

    • Added optional container resizePolicy for main, worker, and webhook components to control behavior when containers are resized, enabling runtime resource updates without forcing pod restarts. Each component exposes a configurable resizePolicy setting (disabled by default).
  • Chores

    • Chart version bumped to 1.0.15 and release annotations updated to document the new capability.

Copy link
Contributor

coderabbitai bot commented Aug 24, 2025

Walkthrough

Bump chart version to 1.0.15 and add support for container resizePolicy for main, worker, and webhook: new resizePolicy keys in values.yaml and conditional rendering of resizePolicy: inside the three container specs. Update Artifact Hub change notes in chart annotations to a single "added" entry linking PR #232.

Changes

Cohort / File(s) Summary
Chart metadata
charts/n8n/Chart.yaml
Incremented chart version 1.0.14 → 1.0.15 and replaced annotations.artifacthub.io/changes entries with one "added" entry describing support for spec.containers.resizePolicy and linking to PR #232.
Values defaults
charts/n8n/values.yaml
Added main.resizePolicy, worker.resizePolicy, and webhook.resizePolicy (lists, default []) with comments documenting resourceName and restartPolicy fields.
Deployment templates: resizePolicy injection
charts/n8n/templates/deployment.yaml, charts/n8n/templates/deployment.worker.yaml, charts/n8n/templates/deployment.webhook.yaml
Each container spec now conditionally emits a resizePolicy: block when the corresponding .Values.*.resizePolicy is defined; rendered via toYaml and placed alongside resources (before volumeMounts where present).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Values as values.yaml
  participant Helm as Helm renderer
  participant K8s as Kubernetes API

  User->>Values: Optionally set *.resizePolicy
  Values->>Helm: Provide values
  Helm->>Helm: If set, render containers[*].resizePolicy via toYaml
  Helm->>K8s: Apply rendered Deployment manifests
  note right of Helm: resizePolicy rendered only when value provided
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 93b4b1a and d258771.

📒 Files selected for processing (1)
  • charts/n8n/Chart.yaml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/n8n/Chart.yaml
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 0

♻️ Duplicate comments (2)
charts/n8n/values.yaml (2)

450-456: Repeat of main: add the same guidance for worker.

Mirror the comments from the main section so users get consistent hints across roles.

Apply the same comment block as suggested for Lines 258-264.


644-650: Repeat of main: add the same guidance for webhook.

Mirror the comments from the main section for consistency.

Apply the same comment block as suggested for Lines 258-264.

🧹 Nitpick comments (6)
charts/n8n/Chart.yaml (1)

37-41: Polish Artifact Hub change entry and remove trailing space.

  • Fix grammar: “Add support for spec.containers.resizePolicy …” and tighten the second sentence.
  • Remove the trailing space flagged by yamllint on Line 41.

Apply this diff:

   artifacthub.io/changes: |
     - kind: added
-      description: Add support spec.containers.resizePolicy for all containers. This allows to control the behavior when a container is resized.
+      description: Add support for spec.containers.resizePolicy for all containers. This allows controlling the behavior when a container is resized.
       links:
         - name: GitHub PR
-          url: https://github.com/8gears/n8n-helm-chart/pull/232 
+          url: https://github.com/8gears/n8n-helm-chart/pull/232
charts/n8n/values.yaml (2)

258-264: Document version support and allowed values for resizePolicy (main).

Add quick guidance for users to avoid applying on unsupported clusters and to constrain inputs to the K8s enum values.

Apply this diff to enrich comments:

   # Container resize policy allows runtime resource updates without pod restart
+  # Requires Kubernetes version that supports in-place resources resize (v1.27+ recommended).
+  # Allowed values per entry:
+  #   resourceName: cpu | memory
+  #   restartPolicy: NotRequired | RestartContainer
   resizePolicy: []
     # - resourceName: cpu
     #   restartPolicy: NotRequired
     # - resourceName: memory
     #   restartPolicy: RestartContainer

Optionally, add a values.schema.json to validate the enum values (see suggestion below).


258-264: Optional: add values.schema.json to validate resizePolicy entries.

This prevents typos and invalid values at chart render time.

Proposed schema snippet (new file: charts/n8n/values.schema.json):

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "type": "object",
  "properties": {
    "main": {
      "type": "object",
      "properties": {
        "resizePolicy": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["resourceName", "restartPolicy"],
            "properties": {
              "resourceName": { "type": "string", "enum": ["cpu", "memory"] },
              "restartPolicy": { "type": "string", "enum": ["NotRequired", "RestartContainer"] }
            },
            "additionalProperties": false
          }
        }
      }
    },
    "worker": { "$ref": "#/properties/main" },
    "webhook": { "$ref": "#/properties/main" }
  }
}

If you want, I can open a follow-up PR to add this schema.

Also applies to: 450-456, 644-650

charts/n8n/templates/deployment.yaml (1)

96-99: Gate resizePolicy on Kubernetes version to avoid apply failures on older clusters.

On unsupported clusters, emitting resizePolicy can cause server-side validation errors. Keep default behavior untouched, but render only when K8s version is compatible, or fail early with a clear message.

Apply this diff:

-          {{- with .Values.main.resizePolicy }}
-          resizePolicy:
-            {{- toYaml . | nindent 12 }}
-          {{- end }}
+          {{- if and (.Values.main.resizePolicy) (semverCompare ">=1.27-0" .Capabilities.KubeVersion.Version) }}
+          resizePolicy:
+            {{- toYaml .Values.main.resizePolicy | nindent 12 }}
+          {{- else if .Values.main.resizePolicy }}
+          {{- fail (printf "main.resizePolicy requires Kubernetes >= 1.27; detected %s" .Capabilities.KubeVersion.Version) }}
+          {{- end }}

If you prefer not to hard-fail, replace fail with a comment or emit nothing and document the version requirement in values.yaml (as suggested).

charts/n8n/templates/deployment.worker.yaml (1)

111-114: Apply the same Kubernetes version guard for worker.

Keep behavior consistent and user-friendly across all roles.

Apply this diff:

-          {{- with .Values.worker.resizePolicy }}
-          resizePolicy:
-            {{- toYaml . | nindent 12 }}
-          {{- end }}
+          {{- if and (.Values.worker.resizePolicy) (semverCompare ">=1.27-0" .Capabilities.KubeVersion.Version) }}
+          resizePolicy:
+            {{- toYaml .Values.worker.resizePolicy | nindent 12 }}
+          {{- else if .Values.worker.resizePolicy }}
+          {{- fail (printf "worker.resizePolicy requires Kubernetes >= 1.27; detected %s" .Capabilities.KubeVersion.Version) }}
+          {{- end }}
charts/n8n/templates/deployment.webhook.yaml (1)

115-118: Apply the same Kubernetes version guard for webhook.

Aligns behavior with main and worker to prevent surprises.

Apply this diff:

-          {{- with .Values.webhook.resizePolicy }}
-          resizePolicy:
-            {{- toYaml . | nindent 12 }}
-          {{- end }}
+          {{- if and (.Values.webhook.resizePolicy) (semverCompare ">=1.27-0" .Capabilities.KubeVersion.Version) }}
+          resizePolicy:
+            {{- toYaml .Values.webhook.resizePolicy | nindent 12 }}
+          {{- else if .Values.webhook.resizePolicy }}
+          {{- fail (printf "webhook.resizePolicy requires Kubernetes >= 1.27; detected %s" .Capabilities.KubeVersion.Version) }}
+          {{- end }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 08f639e and bea3c51.

📒 Files selected for processing (5)
  • charts/n8n/Chart.yaml (2 hunks)
  • charts/n8n/templates/deployment.webhook.yaml (1 hunks)
  • charts/n8n/templates/deployment.worker.yaml (1 hunks)
  • charts/n8n/templates/deployment.yaml (1 hunks)
  • charts/n8n/values.yaml (3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/n8n/Chart.yaml

[error] 41-41: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
charts/n8n/Chart.yaml (1)

3-3: SemVer bump looks right for a feature addition.

Minor version increment to 1.1.0 is appropriate for introducing optional functionality without breaking defaults.

Copy link
Contributor

@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

🧹 Nitpick comments (2)
charts/n8n/Chart.yaml (2)

3-3: Consider minor version bump for a feature addition (SemVer).

Adding a new user-facing capability (container resizePolicy) is a feature, not a bug fix. Per SemVer, consider bumping the chart minor version instead of patch.

-version: 1.0.13
+version: 1.1.0

If the project intentionally treats such changes as patch-level, feel free to keep 1.0.13—just confirm your versioning policy.


37-40: Polish Artifact Hub change entry for clarity and correctness.

Minor grammar fix and more precise field path. Optionally add a link to Kubernetes docs for context.

-    - kind: added
-      description: Add support spec.containers.resizePolicy for all containers. This allows to control the behavior when a container is resized.
-      links:
-        - name: GitHub PR
-          url: https://github.com/8gears/n8n-helm-chart/pull/232
+    - kind: added
+      description: Add support for spec.containers[].resizePolicy for all containers. Controls behavior when a container's CPU/memory resources are resized in-place.
+      links:
+        - name: GitHub PR
+          url: https://github.com/8gears/n8n-helm-chart/pull/232
+        - name: Kubernetes docs
+          url: https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bea3c51 and 21e4dd1.

📒 Files selected for processing (1)
  • charts/n8n/Chart.yaml (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/n8n/Chart.yaml

[error] 41-41: trailing spaces

(trailing-spaces)

@younsl
Copy link
Author

younsl commented Aug 25, 2025

@Vad1mo @RoseSecurity PTAL. I need a this feature in my production n8n chart.

@RoseSecurity
Copy link
Contributor

Testing this today. Thanks for contributing

Copy link
Contributor

@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

🧹 Nitpick comments (2)
charts/n8n/Chart.yaml (2)

37-41: Polish Artifact Hub change note grammar for clarity.

Improve wording and be explicit about the field path.

   artifacthub.io/changes: |
-    - kind: added
-      description: Add support spec.containers.resizePolicy for all containers. This allows to control the behavior when a container is resized.
-      links:
+    - kind: added
+      description: Add support for spec.containers.resizePolicy on all containers. This lets you control restart behavior when CPU/memory resources are resized.
+      links:
         - name: GitHub PR
           url: https://github.com/8gears/n8n-helm-chart/pull/232

37-41: Add a short compatibility hint (docs/values) for resizePolicy.

Consider noting that container resizePolicy is supported from Kubernetes 1.27 (alpha) and appears in the API reference by 1.29; in-place resize is enabled by default starting 1.33 (Beta). This helps users know when the new values work as intended. (kubernetes.io)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5ac6e87 and 538088b.

📒 Files selected for processing (4)
  • charts/n8n/Chart.yaml (2 hunks)
  • charts/n8n/templates/deployment.webhook.yaml (1 hunks)
  • charts/n8n/templates/deployment.worker.yaml (1 hunks)
  • charts/n8n/templates/deployment.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • charts/n8n/templates/deployment.worker.yaml
  • charts/n8n/templates/deployment.yaml
  • charts/n8n/templates/deployment.webhook.yaml
🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/n8n/Chart.yaml

[error] 41-41: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (1)
charts/n8n/Chart.yaml (1)

3-3: Version bump looks good.

Patch version increase to 1.0.14 is consistent with a backward-compatible feature addition.

@younsl
Copy link
Author

younsl commented Sep 1, 2025

@RoseSecurity Any updates?

Copy link
Contributor

@RoseSecurity RoseSecurity left a comment

Choose a reason for hiding this comment

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

This has been tested and works as intended. Looks good

@younsl
Copy link
Author

younsl commented Sep 2, 2025

@RoseSecurity Thx. Ready to merge after resolving conflicts caused by d06fe8b.

* This rebump is caused by PR 8gears#239

Signed-off-by: younsl <[email protected]>
@younsl
Copy link
Author

younsl commented Sep 2, 2025

@Vad1mo @RoseSecurity Please merge if no blockers.

@younsl
Copy link
Author

younsl commented Sep 13, 2025

@Vad1mo @RoseSecurity Gentle ping for merging

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants