Skip to content

Conversation

@obsidian33
Copy link

@obsidian33 obsidian33 commented Oct 7, 2025

What this PR does / why we need it

This PR adds basic support for specifying extraContainers (sidecar) which can be used in main, worker, and webhook deployments.

I want this feature added so I can add external n8n runner sidecar with the workers but it is generic enough to allow users to setup any sidecar they need. I tested this locally using:

worker:
  extraContainers:
    - name: n8n-runners
      image: "n8nio/runners:1.114.3"
      env:
        - name: N8N_RUNNERS_AUTH_TOKEN
          valueFrom:
            secretKeyRef:
              name: n8n-app-secret
              key: N8N_RUNNERS_AUTH_TOKEN
        - name: N8N_RUNNERS_TASK_BROKER_URI
          value: "http://127.0.0.1:5679"
      ports:
        - name: runner-health
          containerPort: 5680
      livenessProbe:
        httpGet:
          path: /healthz
          port: runner-health
        initialDelaySeconds: 5
        periodSeconds: 10

Special notes for your reviewer

This PR was originally submitted by ArnaudTA in PR #180 but it has sat a month without addressing reviewer concerns.

Checklist

Version and Documentation

Testing and Validation

  • Ran ah lint locally without errors
  • Ran Chart-Testing: ct lint --chart-dirs charts/n8n --charts charts/n8n --validate-maintainers=false
  • Tested chart installation locally
  • Tested with example configurations in /examples directory

Summary by CodeRabbit

  • New Features

    • Add support for configuring extra sidecar containers via extraContainers for main, worker, and webhook deployments (no effect unless configured).
  • Documentation

    • Values and README updated with commented examples showing how to define extraContainers.
  • Chores

    • Chart version bumped to 1.2.0 and changelog updated to note extraContainers support.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds a new Helm values key extraContainers (default: empty list) to main, worker, and webhook sections; documents it in README and values.yaml; deployment templates for main, worker, and webhook conditionally render .Values.*.extraContainers via tpl(toYaml(...)); chart version bumped to 1.2.0.

Changes

Cohort / File(s) Summary
Documentation
README.md
Documents new extraContainers field with a commented YAML example for sidecar containers.
Chart metadata
charts/n8n/Chart.yaml
Bumps chart version to 1.2.0 and updates changelog to note added extraContainers support.
Deployment templates
charts/n8n/templates/deployment.yaml, charts/n8n/templates/deployment.worker.yaml, charts/n8n/templates/deployment.webhook.yaml
Adds conditional blocks that render .Values.<scope>.extraContainers into the .spec.template.spec.containers list using tpl(toYaml(...)) when provided.
Values
charts/n8n/values.yaml
Adds extraContainers: [] entries (with commented example entries) under main, worker, and webhook sections.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Helm as Helm template engine
  participant K8s as Kubernetes API

  User->>Helm: helm install/upgrade (values may include extraContainers)
  Helm->>Helm: For each scope (main/worker/webhook) check .Values.<scope>.extraContainers
  alt extraContainers provided
    Helm->>Helm: tpl(toYaml(extraContainers)) → render additional container YAML
    note right of Helm `#E6F7FF`: Insert rendered blocks into\n.spec.template.spec.containers
  else not provided
    Helm->>Helm: Render default containers only
  end
  Helm->>K8s: Apply rendered Deployment manifests
  K8s-->>User: Deployments created/updated
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to indentation/templating in tpl(toYaml(...)) blocks in each deployment template.
  • Verify Chart.yaml version bump consistency with release process.
  • Confirm values examples in values.yaml are properly commented and syntactically valid.

Suggested reviewers

  • Vad1mo

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 'add extraContainers support' directly and clearly summarizes the main change: introducing extraContainers functionality for the n8n Helm chart deployments.
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

📜 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 04bedfa and 92eb41c.

📒 Files selected for processing (6)
  • README.md (3 hunks)
  • 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)
🚧 Files skipped from review as they are similar to previous changes (5)
  • charts/n8n/templates/deployment.yaml
  • charts/n8n/templates/deployment.worker.yaml
  • charts/n8n/templates/deployment.webhook.yaml
  • README.md
  • charts/n8n/Chart.yaml
🔇 Additional comments (1)
charts/n8n/values.yaml (1)

270-275: Configuration structure and documentation are well-structured and consistent.

All three extraContainers additions (main, worker, webhook) follow the same clean pattern:

  • Logical placement after termination grace period configuration
  • Clear comment explaining purpose
  • Empty list default (appropriate for optional feature)
  • Practical commented example

The naming and structure align with existing optional config keys like initContainers, and the YAML list structure is correct for consumption by templates.

Also applies to: 465-470, 659-664


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.

@obsidian33 obsidian33 force-pushed the support-extraContainers branch 2 times, most recently from 086f9aa to 04bedfa Compare October 7, 2025 20:46
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

🧹 Nitpick comments (8)
charts/n8n/templates/deployment.worker.yaml (1)

118-120: Worker sidecars block is correct and consistent

Good use of tpl(toYaml(...)) with proper indentation.

Optional: allow merging in a shared .Values.extraContainers to reduce duplication when the same sidecars are needed on all pods.

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

122-124: Webhook sidecars block is correct

Matches the pattern used for main/worker and will append valid container specs.

Optional: consider supporting a shared .Values.extraContainers for common sidecars.

README.md (3)

358-364: Clarify what’s allowed in extraContainers entries

Suggest adding a note that each item is a full Kubernetes Container spec and Helm templating is supported (tpl), plus a brief example including resources and a probe.


550-556: Worker docs: include a sidecar example tailored to workers

Add an example showing envFrom/secretKeyRef and ports typical for worker‑side runners, as mentioned in the PR description.


742-748: Webhook docs: add a minimal HTTP sidecar example

Consider adding a webhook‑specific sidecar example (e.g., tiny HTTP helper) and remind users to set any needed volumeMounts within the sidecar.

charts/n8n/values.yaml (3)

267-273: Document that items are full Container specs and can use templating

Add a one‑liner: entries accept the standard K8s Container fields; Helm templating is supported; include a short example with resources.


459-465: Worker: add example with envFrom/ports

Provide a worker‑focused example (envFrom with secretKeyRef, ports, readinessProbe) to guide typical runner sidecars.


650-656: Webhook: add example and note about volume mounts

Include a brief example and a note that sidecars can declare their own volumeMounts which must match pod volumes defined under extraVolumes.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec66f7c and 086f9aa.

📒 Files selected for processing (6)
  • README.md (3 hunks)
  • 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
🧠 Learnings (1)
📚 Learning: 2025-09-02T08:05:39.372Z
Learnt from: tsch157
PR: 8gears/n8n-helm-chart#239
File: charts/n8n/Chart.yaml:3-4
Timestamp: 2025-09-02T08:05:39.372Z
Learning: n8n 1.110.0 is a pre-release version and should not be used in production deployments. Always verify if a version is stable before recommending upgrades in the n8n Helm chart.

Applied to files:

  • charts/n8n/Chart.yaml
🔇 Additional comments (3)
charts/n8n/Chart.yaml (2)

3-4: Verify appVersion is a stable release

Version bumps look fine. Please double‑check n8n 1.114.3 isn’t a pre‑release before publishing.

Based on learnings


37-38: Changelog entry LGTM

Accurate “added” entry for extraContainers support.

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

103-105: Sidecar rendering under containers looks correct

tpl(toYaml .Values.main.extraContainers) | nindent 8 correctly appends sidecars to the containers list.
Optional: consider a shared .Values.extraContainers to DRY identical sidecars across main/worker/webhook.
Please verify the rendered output in your local Helm environment.

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

🧹 Nitpick comments (1)
charts/n8n/templates/deployment.worker.yaml (1)

118-120: Placement/indentation LGTM; consider merging global + worker extras.

Rendering with tpl(toYaml ...) at nindent 8 correctly appends sidecars under containers:. To align with the PR’s “top‑level extraContainers” intent and reduce duplication, merge .Values.extraContainers with .Values.worker.extraContainers before rendering.

Apply this diff to support both sources:

-      {{- if .Values.worker.extraContainers }}
-        {{ tpl (toYaml .Values.worker.extraContainers) . | nindent 8 }}
-      {{- end }}
+      {{- $extra := list }}
+      {{- if .Values.extraContainers }}{{- $extra = concat $extra .Values.extraContainers }}{{- end }}
+      {{- if .Values.worker.extraContainers }}{{- $extra = concat $extra .Values.worker.extraContainers }}{{- end }}
+      {{- if $extra }}
+        {{ tpl (toYaml $extra) . | nindent 8 }}
+      {{- end }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 086f9aa and 04bedfa.

📒 Files selected for processing (6)
  • README.md (3 hunks)
  • 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)
🚧 Files skipped from review as they are similar to previous changes (5)
  • README.md
  • charts/n8n/Chart.yaml
  • charts/n8n/values.yaml
  • charts/n8n/templates/deployment.webhook.yaml
  • charts/n8n/templates/deployment.yaml

@mubarak-j
Copy link

looks like n8n is gearing up for v2 changes where task runners will be the default execution, this PR will be needed to run external tasks runners in sidecar.

@FannWuCircle
Copy link

@obsidian33 It's good feature, but PR conflict and need to resolve.

@obsidian33 obsidian33 force-pushed the support-extraContainers branch from 04bedfa to 92eb41c Compare December 1, 2025 19:33
@obsidian33
Copy link
Author

@FannWuCircle PR conflict resolved.

@Vad1mo
Copy link
Member

Vad1mo commented Dec 4, 2025

This will be in the next release

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.

4 participants