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 envfrom into deployments to enable loading entire secrets or configMaps into container ENV_VARs #109

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ extraEnv: { }
# Set this if running behind a reverse proxy and the external port is different from the port n8n runs on
# WEBHOOK_TUNNEL_URL: "https://n8n.myhost.com/

# Set additional environment variables on the Deployment from k8s secrets
envFrom: []
# List of existing secrets to add to deployments
# - secretRef:
# name: secret-name

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Documentation for the new envFrom feature needs enhancement

While the basic structure for envFrom configuration is documented, it would benefit from:

  1. A description of its purpose (loading entire secrets/configMaps as environment variables)
  2. An example showing how to use it with ExternalSecrets from AWS SSM ParameterStore
  3. Integration with the "Typical Values Example" section

Add the following content after line 200:

 # - secretRef:
 #     name: secret-name
+
+# Example using envFrom with AWS SSM ParameterStore via ExternalSecrets:
+# envFrom:
+# - secretRef:
+#     name: my-external-secret # Secret created by ExternalSecrets
+
+# For more information about using envFrom with ExternalSecrets, see:
+# https://external-secrets.io/latest/guides/common-k8s-secret-types/#basic-secret

Also, add this example to the "Typical Values Example" section:

 secret:
   database:
     postgresdb:
       password: 'big secret'
+
+# Load all environment variables from an existing secret
+envFrom:
+  - secretRef:
+      name: my-environment-variables

Committable suggestion skipped: line range outside the PR's diff.

replicaCount: 1

image:
Expand Down
4 changes: 4 additions & 0 deletions charts/n8n/templates/deployment.webhooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ spec:
args: ["webhook"]
env:
{{- include "n8n.deploymentPodEnvironments" . | nindent 12 }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ get .Values.config "port" | default 5678 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/n8n/templates/deployment.worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ spec:
args: ["worker", "--concurrency={{ .Values.scaling.worker.concurrency }}"]
env:
{{- include "n8n.deploymentPodEnvironments" . | nindent 12 }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ get .Values.config "port" | default 5678 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/n8n/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- include "n8n.deploymentPodEnvironments" . | nindent 12 }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
lifecycle:
{{- toYaml .Values.lifecycle | nindent 12 }}
ports:
Expand Down
4 changes: 4 additions & 0 deletions charts/n8n/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ extraEnvSecrets: {}
# name: postgres-user-auth
# key: password

envFrom: []
# - secretRef:
# name: secret-name

## Common Kubernetes Config Settings
persistence:
## If true, use a Persistent Volume Claim, If false, use emptyDir
Expand Down