Skip to content

add extraContainers support - #252

Closed
obsidian33 wants to merge 1 commit into
8gears:mainfrom
curative:support-extraContainers
Closed

obsidian33 wants to merge 1 commit into
8gears:mainfrom
curative:support-extraContainers

Conversation

@obsidian33

@obsidian33 obsidian33 commented Oct 7, 2025

Copy link
Copy Markdown

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

coderabbitai Bot commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

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

@coderabbitai coderabbitai 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.

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.

@coderabbitai coderabbitai 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.

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

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

@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
Copy Markdown
Author

@FannWuCircle PR conflict resolved.

@Vad1mo

Vad1mo commented Dec 4, 2025

Copy link
Copy Markdown
Member

This will be in the next release

amcharles91 added a commit to amcharles91/n8n-helm-chart that referenced this pull request Dec 26, 2025
Merges 8gears#252 which adds extraContainers support
for main, worker, and webhook deployments. This enables adding
n8n-runners sidecar for external task runner mode.

Resolved conflict: kept version 2.0.2 (bumped from 2.0.1) with
current appVersion 1.122.4 while incorporating extraContainers feature.
@daniel-lee-sb

Copy link
Copy Markdown

This will be in the next release

@Vad1mo When would this be released?
I want to upgrade the version now, but I think this PR should be released to enable the task runner. A task runner is required for me due to a security issue with Python code on Node.

@maciej-wolny

maciej-wolny commented Jan 7, 2026

Copy link
Copy Markdown

+1 When can we expect the new release? That's a very important feature for production! To support runners we also need to expose the 5679 port

@mstiri

mstiri commented Jan 8, 2026

Copy link
Copy Markdown

This is a much needed feature for production as I need a sidecar for task runners. Is it expected to be merged and released very soon?

@FannWuCircle

FannWuCircle commented Jan 15, 2026

Copy link
Copy Markdown

@Vad1mo @obsidian33
The CVE score is 9.9 and it's better to release it quickly for n8n 2.0 upgrade....
GHSA-62r4-hw23-cc8v

@GuilleAmutio

Copy link
Copy Markdown

Is it expected to be merged in the next week or so?

@obsidian33

Copy link
Copy Markdown
Author

@Vad1mo @obsidian33 The CVE score is 9.9 and it's better to release it quickly for n8n 2.0 upgrade.... GHSA-62r4-hw23-cc8v

Just an FYI, that I submitted the PR but I'm not part of the 8gears team or a maintainer. We're still waiting on them.

@elabbarw

Copy link
Copy Markdown

Any update on this please?

@elabbarw

elabbarw commented Jan 23, 2026

Copy link
Copy Markdown

@obsidian33 I saw your PR this morning and chose violence 😄 - forked your repo, built a Helm package internally, and can confirm it fixed the issue with external runners on K8S. Thanks a lot, sir!
image

@obsidian33

Copy link
Copy Markdown
Author

@obsidian33 I saw your PR this morning and chose violence 😄 - forked your repo, built a Helm package internally, and can confirm it fixed the issue with external runners on K8S. Thanks a lot, sir!

image

No worries. Until this gets a maintainers attention... there's not much else we can do unfortunately 😓

@mubarak-j mubarak-j left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We ended up using the existing initContainers for workers in this chart in a way that matches the recommended method for running Sidecars containers in K8s (source official K8s docs), i.e., initContainers that are set with restartPolicy: Always, as shown below:

main:
    config:
      n8n:
        # external task runner settings
        runners_enabled: true
        runners_mode: external

workers:
  initContainers:
      - name: n8n-runners
        image: "n8nio/runners:2.4.8"
        restartPolicy: Always
        env:
          - name: N8N_RUNNERS_AUTH_TOKEN
            valueFrom:
              secretKeyRef:
                name: n8n-secrets
                key: N8N_RUNNERS_AUTH_TOKEN
          - name: N8N_RUNNERS_TASK_BROKER_URI
            value: "http://127.0.0.1:5679"
          - name: N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT
            value: "115" 
        ports:
          - name: runner-health
            containerPort: 5680
        livenessProbe:
          httpGet:
            path: /healthz
            port: runner-health
          initialDelaySeconds: 5
          periodSeconds: 10

Small tip, you could hit a few gotchas with running Python code, with default runner settings, take a look at the workarounds mentioned in these 2 issues
n8n-io/n8n#23120
n8n-io/n8n#24175

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.

10 participants