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 impact unless configured.
  • Documentation

    • README and values updated with examples showing how to define extraContainers for sidecars.
  • Chores

    • Bumped chart version to 1.1.0 and appVersion to 1.114.3.
    • Updated changelog to note extraContainers support.

Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds a new Helm values key extraContainers (default: empty list) to main, worker, webhook, and top-level sections; documents it in README and values.yaml; templates for main, worker, and webhook Deployments now conditionally render provided extraContainers via tpl(toYaml(...)); chart metadata version/appVersion updated.

Changes

Cohort / File(s) Summary
Documentation
README.md
Documents new extraContainers field with commented YAML example for sidecar containers.
Chart metadata
charts/n8n/Chart.yaml
Bumps chart version to 1.1.0 and appVersion to 1.114.3; updates Artifact Hub 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.*.extraContainers into the .spec.template.spec.containers list using tpl(toYaml(...)) when provided.
Values
charts/n8n/values.yaml
Adds extraContainers: [] entries (with commented examples) under main, worker, webhook, and a top-level/global scope.

Sequence Diagram(s)

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

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

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Vad1mo
  • alexandre-k
  • fank

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 describes the primary change, namely adding support for the extraContainers configuration option, without extraneous detail or ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • 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

Comment @coderabbitai help to get the list of available commands and usage tips.

@obsidian33 obsidian33 force-pushed the support-extraContainers branch from f867d60 to 086f9aa Compare October 7, 2025 20:42
@obsidian33 obsidian33 force-pushed the support-extraContainers branch 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

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.

1 participant