Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add environment settings to worker deployment #143

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/n8n/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: n8n
version: 1.0.1
version: 1.1.0
appVersion: 1.76.1
type: application
description: "A Kubernetes Helm chart for n8n a free and open fair-code licensed node based Workflow Automation Tool. Easily automate tasks across different services."
Expand Down Expand Up @@ -34,4 +34,4 @@ annotations:
# supported kinds are added, changed, deprecated, removed, fixed and security.
artifacthub.io/changes: |
- kind: changed
description: "Add default port to worker, deployment and webhook when undefined"
description: "Add environment settings to worker deployment"
10 changes: 10 additions & 0 deletions charts/n8n/templates/configmap.worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.worker.config }}
apiVersion: v1
kind: ConfigMap
metadata:
name: worker-config-{{ include "n8n.fullname" . }}
labels:
{{- include "n8n.labels" . | nindent 4 }}
data:
{{- include "toEnvVars" (dict "values" .Values.worker.config "prefix" "") | nindent 2 }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/n8n/templates/deployment.worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ spec:
{{- toYaml .Values.worker.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
{{- if .Values.main.config }}
- configMapRef:
name: app-config-{{ include "n8n.fullname" . }}
{{- end }}
{{- if .Values.main.secret }}
- secretRef:
name: app-secret-{{ include "n8n.fullname" . }}
{{- end }}
{{- if .Values.worker.config }}
- configMapRef:
name: worker-config-{{ include "n8n.fullname" . }}
{{- end }}
{{- if .Values.worker.secret }}
- secretRef:
name: worker-secret-{{ include "n8n.fullname" . }}
{{- end }}
env: {{ not (empty .Values.worker.extraEnv) | ternary nil "[]" }}
{{- range $key, $value := .Values.worker.extraEnv }}
- name: {{ $key }}
{{- toYaml $value | nindent 14 }}
{{- end }}
{{- if .Values.worker.command }}
command:
{{- toYaml .Values.worker.command | nindent 12 }}
Expand Down
12 changes: 12 additions & 0 deletions charts/n8n/templates/secret.worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.worker.secret }}
apiVersion: v1
kind: Secret
metadata:
name: worker-secret-{{ include "n8n.fullname" . }}
labels:
{{- include "n8n.labels" . | nindent 4 }}
type: Opaque
data:
{{- include "toEnvVars" (dict "values" .Values.worker.secret "prefix" "" "isSecret" true) | nindent 4 }}

{{- end }}
12 changes: 12 additions & 0 deletions charts/n8n/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,18 @@ main:
#
worker:
enabled: false

# additional (to main) config for worker
config: {}

# additional (to main) config for worker
secret: {}

# Extra environmental variables, so you can reference other configmaps and secrets into n8n as env vars.
extraEnv: {}
# WEBHOOK_URL:
# value: "http://webhook.domain.tld"

count: 2
# You can define the number of jobs a worker can run in parallel by using the concurrency flag. It defaults to 10. To change it:
concurrency: 10
Expand Down