From b82f0916e4d6616f4c337464dc8e70d3e97754be Mon Sep 17 00:00:00 2001 From: Neil Carpenter Date: Sat, 8 Jun 2024 19:38:07 -0400 Subject: [PATCH 1/6] Add additionalVolumes, additionalvolumeMounts --- templates/deployment.webhooks.yaml | 6 ++++++ templates/deployment.worker.yaml | 6 ++++++ templates/deployment.yaml | 6 ++++++ values.yaml | 8 ++++++++ 4 files changed, 26 insertions(+) diff --git a/templates/deployment.webhooks.yaml b/templates/deployment.webhooks.yaml index 3b7f22e..6a2c7f3 100644 --- a/templates/deployment.webhooks.yaml +++ b/templates/deployment.webhooks.yaml @@ -73,6 +73,9 @@ spec: - name: secret-volume mountPath: /n8n-secret {{- end }} + {{- if .Values.additionalVolumeMounts }} +{{ toYaml .Values.additionalVolumeMounts | indent 8}} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -101,4 +104,7 @@ spec: - key: "secret.json" path: "secret.json" {{- end }} + {{- if .Values.additionalVolumes }} +{{ toYaml .Values.additionalVolumes | indent 8}} + {{- end }} {{- end }} diff --git a/templates/deployment.worker.yaml b/templates/deployment.worker.yaml index 0014d3e..18212a6 100644 --- a/templates/deployment.worker.yaml +++ b/templates/deployment.worker.yaml @@ -73,6 +73,9 @@ spec: - name: secret-volume mountPath: /n8n-secret {{- end }} + {{- if .Values.additionalVolumeMounts }} +{{ toYaml .Values.additionalVolumeMounts | indent 8}} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -101,4 +104,7 @@ spec: - key: "secret.json" path: "secret.json" {{- end }} + {{- if .Values.additionalVolumes }} +{{ toYaml .Values.additionalVolumes | indent 8}} + {{- end }} {{- end }} diff --git a/templates/deployment.yaml b/templates/deployment.yaml index a458441..6ae6088 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -94,6 +94,9 @@ spec: - name: secret-volume mountPath: /n8n-secret {{- end }} + {{- if .Values.additionalVolumeMounts }} +{{ toYaml .Values.additionalVolumeMounts | indent 8}} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -122,3 +125,6 @@ spec: - key: "secret.json" path: "secret.json" {{- end }} + {{- if .Values.additionalVolumes }} +{{ toYaml .Values.additionalVolumes | indent 8}} + {{- end }} diff --git a/values.yaml b/values.yaml index 2f6e800..42b5625 100644 --- a/values.yaml +++ b/values.yaml @@ -334,3 +334,11 @@ redis: enabled: true existingClaim: "" size: 2Gi + +## specify additional volumes to mount in the core container, this can be used +## to specify additional storage of material or to inject files from ConfigMaps +## into the running container +additionalVolumes: [] + +## specify where the additional volumes are mounted in the core container +additionalVolumeMounts: [] \ No newline at end of file From 3b99ea5a3e11f3e2664ef13b3c068c8fff51ac88 Mon Sep 17 00:00:00 2001 From: Neil Carpenter Date: Sat, 8 Jun 2024 19:46:53 -0400 Subject: [PATCH 2/6] Fix indent --- templates/deployment.webhooks.yaml | 4 ++-- templates/deployment.worker.yaml | 4 ++-- templates/deployment.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/deployment.webhooks.yaml b/templates/deployment.webhooks.yaml index 6a2c7f3..7182df4 100644 --- a/templates/deployment.webhooks.yaml +++ b/templates/deployment.webhooks.yaml @@ -74,7 +74,7 @@ spec: mountPath: /n8n-secret {{- end }} {{- if .Values.additionalVolumeMounts }} -{{ toYaml .Values.additionalVolumeMounts | indent 8}} +{{ toYaml .Values.additionalVolumeMounts | indent 10}} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -105,6 +105,6 @@ spec: path: "secret.json" {{- end }} {{- if .Values.additionalVolumes }} -{{ toYaml .Values.additionalVolumes | indent 8}} +{{ toYaml .Values.additionalVolumes | indent 10}} {{- end }} {{- end }} diff --git a/templates/deployment.worker.yaml b/templates/deployment.worker.yaml index 18212a6..27bd76f 100644 --- a/templates/deployment.worker.yaml +++ b/templates/deployment.worker.yaml @@ -74,7 +74,7 @@ spec: mountPath: /n8n-secret {{- end }} {{- if .Values.additionalVolumeMounts }} -{{ toYaml .Values.additionalVolumeMounts | indent 8}} +{{ toYaml .Values.additionalVolumeMounts | indent 10}} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -105,6 +105,6 @@ spec: path: "secret.json" {{- end }} {{- if .Values.additionalVolumes }} -{{ toYaml .Values.additionalVolumes | indent 8}} +{{ toYaml .Values.additionalVolumes | indent 10}} {{- end }} {{- end }} diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 6ae6088..7048393 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -95,7 +95,7 @@ spec: mountPath: /n8n-secret {{- end }} {{- if .Values.additionalVolumeMounts }} -{{ toYaml .Values.additionalVolumeMounts | indent 8}} +{{ toYaml .Values.additionalVolumeMounts | indent 10}} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -126,5 +126,5 @@ spec: path: "secret.json" {{- end }} {{- if .Values.additionalVolumes }} -{{ toYaml .Values.additionalVolumes | indent 8}} +{{ toYaml .Values.additionalVolumes | indent 10}} {{- end }} From d81d5f360bb366fced37ec1db2d4950002fa9518 Mon Sep 17 00:00:00 2001 From: Neil Carpenter Date: Sat, 8 Jun 2024 20:29:36 -0400 Subject: [PATCH 3/6] Really fix indent --- deploy.yaml | 153 +++++++++++++++++++++++++++++ templates/deployment.webhooks.yaml | 4 +- templates/deployment.worker.yaml | 4 +- templates/deployment.yaml | 6 +- values.yaml | 14 +-- 5 files changed, 168 insertions(+), 13 deletions(-) create mode 100644 deploy.yaml diff --git a/deploy.yaml b/deploy.yaml new file mode 100644 index 0000000..2a0e442 --- /dev/null +++ b/deploy.yaml @@ -0,0 +1,153 @@ +--- +# Source: n8n/templates/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: n8n + labels: + helm.sh/chart: n8n-0.23.0 + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/version: "1.33.1" + app.kubernetes.io/managed-by: Helm +--- +# Source: n8n/templates/configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: n8n + labels: + helm.sh/chart: n8n-0.23.0 + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/version: "1.33.1" + app.kubernetes.io/managed-by: Helm +data: + config.json: | + { + "executions": { + "pruneData": "true", + "pruneDataMaxAge": 3760 + } + } +--- +# Source: n8n/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: n8n + labels: + helm.sh/chart: n8n-0.23.0 + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/version: "1.33.1" + app.kubernetes.io/managed-by: Helm +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/type: master +--- +# Source: n8n/templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: n8n + labels: + helm.sh/chart: n8n-0.23.0 + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/version: "1.33.1" + app.kubernetes.io/managed-by: Helm +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/type: master + template: + metadata: + annotations: + checksum/config: c0bb3980c19270be5448f1677eb9ff58d0f643980e091527cb8da450033adc84 + labels: + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/type: master + + spec: + serviceAccountName: n8n + securityContext: + fsGroup: 1000 + runAsGroup: 1000 + runAsNonRoot: true + runAsUser: 1000 + containers: + - name: n8n + securityContext: + {} + image: "n8nio/n8n:1.33.1" + imagePullPolicy: IfNotPresent + env: + + - name: "N8N_PORT" #! we better set the port once again as ENV Var, see: https://community.n8n.io/t/default-config-is-not-set-or-the-port-to-be-more-precise/3158/3?u=vad1mo + value: "5678" + - name: "N8N_CONFIG_FILES" + value: "/n8n-config/config.json" + + lifecycle: + {} + ports: + - name: http + containerPort: 5678 + protocol: TCP + livenessProbe: + httpGet: + path: /healthz + port: http + readinessProbe: + httpGet: + path: /healthz + port: http + resources: + {} + volumeMounts: + - name: data + mountPath: /home/node/.n8n + - name: config-volume + mountPath: /n8n-config + volumes: + - name: "data" + emptyDir: {} + - name: config-volume + configMap: + name: n8n +--- +# Source: n8n/templates/tests/test-connection.yaml +apiVersion: v1 +kind: Pod +metadata: + name: "n8n-test-connection" + labels: + helm.sh/chart: n8n-0.23.0 + app.kubernetes.io/name: n8n + app.kubernetes.io/instance: n8n + app.kubernetes.io/version: "1.33.1" + app.kubernetes.io/managed-by: Helm + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['n8n:80'] + restartPolicy: Never diff --git a/templates/deployment.webhooks.yaml b/templates/deployment.webhooks.yaml index 7182df4..fb1e646 100644 --- a/templates/deployment.webhooks.yaml +++ b/templates/deployment.webhooks.yaml @@ -74,7 +74,7 @@ spec: mountPath: /n8n-secret {{- end }} {{- if .Values.additionalVolumeMounts }} -{{ toYaml .Values.additionalVolumeMounts | indent 10}} +{{ toYaml .Values.additionalVolumeMounts | indent 12}} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -105,6 +105,6 @@ spec: path: "secret.json" {{- end }} {{- if .Values.additionalVolumes }} -{{ toYaml .Values.additionalVolumes | indent 10}} +{{ toYaml .Values.additionalVolumes | indent 8}} {{- end }} {{- end }} diff --git a/templates/deployment.worker.yaml b/templates/deployment.worker.yaml index 27bd76f..1bf81a6 100644 --- a/templates/deployment.worker.yaml +++ b/templates/deployment.worker.yaml @@ -74,7 +74,7 @@ spec: mountPath: /n8n-secret {{- end }} {{- if .Values.additionalVolumeMounts }} -{{ toYaml .Values.additionalVolumeMounts | indent 10}} +{{ toYaml .Values.additionalVolumeMounts | indent 12}} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -105,6 +105,6 @@ spec: path: "secret.json" {{- end }} {{- if .Values.additionalVolumes }} -{{ toYaml .Values.additionalVolumes | indent 10}} +{{ toYaml .Values.additionalVolumes | indent 8}} {{- end }} {{- end }} diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 7048393..b17fa4d 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -65,6 +65,7 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + env: {{- include "n8n.deploymentPodEnvironments" . | nindent 12 }} lifecycle: @@ -95,7 +96,7 @@ spec: mountPath: /n8n-secret {{- end }} {{- if .Values.additionalVolumeMounts }} -{{ toYaml .Values.additionalVolumeMounts | indent 10}} +{{ toYaml .Values.additionalVolumeMounts | indent 12}} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -125,6 +126,7 @@ spec: - key: "secret.json" path: "secret.json" {{- end }} + {{- if .Values.additionalVolumes }} -{{ toYaml .Values.additionalVolumes | indent 10}} +{{ toYaml .Values.additionalVolumes | indent 8 }} {{- end }} diff --git a/values.yaml b/values.yaml index 42b5625..de87233 100644 --- a/values.yaml +++ b/values.yaml @@ -335,10 +335,10 @@ redis: existingClaim: "" size: 2Gi -## specify additional volumes to mount in the core container, this can be used -## to specify additional storage of material or to inject files from ConfigMaps -## into the running container -additionalVolumes: [] - -## specify where the additional volumes are mounted in the core container -additionalVolumeMounts: [] \ No newline at end of file +additionalVolumeMounts: +- mountPath: /public + name: public +additionalVolumes: +- hostPath: + path: /mnt/public + name: public \ No newline at end of file From 3565a5314079e3bdd88b52091472931518c5fde9 Mon Sep 17 00:00:00 2001 From: Neil Carpenter Date: Mon, 10 Jun 2024 09:13:52 -0400 Subject: [PATCH 4/6] Fix values.yaml --- values.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/values.yaml b/values.yaml index de87233..42b5625 100644 --- a/values.yaml +++ b/values.yaml @@ -335,10 +335,10 @@ redis: existingClaim: "" size: 2Gi -additionalVolumeMounts: -- mountPath: /public - name: public -additionalVolumes: -- hostPath: - path: /mnt/public - name: public \ No newline at end of file +## specify additional volumes to mount in the core container, this can be used +## to specify additional storage of material or to inject files from ConfigMaps +## into the running container +additionalVolumes: [] + +## specify where the additional volumes are mounted in the core container +additionalVolumeMounts: [] \ No newline at end of file From 0305e5812af2ce559e08a5fbc4e4321f69ecdd72 Mon Sep 17 00:00:00 2001 From: Neil Carpenter Date: Mon, 10 Jun 2024 09:16:32 -0400 Subject: [PATCH 5/6] Add sample volume/volumeMount --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ed390f..136eee7 100644 --- a/README.md +++ b/README.md @@ -287,6 +287,14 @@ scaling: redis: enabled: false # Other default redis values: https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml + +## specify additional volumes to mount in the core container, this can be used +## to specify additional storage of material or to inject files from ConfigMaps +## into the running container +additionalVolumes: [] + +## specify where the additional volumes are mounted in the core container +additionalVolumeMounts: [] ``` # Typical Values Example @@ -305,7 +313,13 @@ secret: database: postgresdb: password: 'big secret' - +additionalVolumeMounts: + - mountPath: /public + name: public +additionalVolumes: + - hostPath: + path: /mnt/public + name: public ``` ## Setup From bef519e432b4385ff704cc54237f08f9d1d02237 Mon Sep 17 00:00:00 2001 From: Neil Carpenter Date: Mon, 10 Jun 2024 09:20:53 -0400 Subject: [PATCH 6/6] Remove extraneous --- deploy.yaml | 153 ---------------------------------------------------- 1 file changed, 153 deletions(-) delete mode 100644 deploy.yaml diff --git a/deploy.yaml b/deploy.yaml deleted file mode 100644 index 2a0e442..0000000 --- a/deploy.yaml +++ /dev/null @@ -1,153 +0,0 @@ ---- -# Source: n8n/templates/serviceaccount.yaml -apiVersion: v1 -kind: ServiceAccount -metadata: - name: n8n - labels: - helm.sh/chart: n8n-0.23.0 - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/version: "1.33.1" - app.kubernetes.io/managed-by: Helm ---- -# Source: n8n/templates/configmap.yaml -apiVersion: v1 -kind: ConfigMap -metadata: - name: n8n - labels: - helm.sh/chart: n8n-0.23.0 - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/version: "1.33.1" - app.kubernetes.io/managed-by: Helm -data: - config.json: | - { - "executions": { - "pruneData": "true", - "pruneDataMaxAge": 3760 - } - } ---- -# Source: n8n/templates/service.yaml -apiVersion: v1 -kind: Service -metadata: - name: n8n - labels: - helm.sh/chart: n8n-0.23.0 - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/version: "1.33.1" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - ports: - - port: 80 - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/type: master ---- -# Source: n8n/templates/deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: n8n - labels: - helm.sh/chart: n8n-0.23.0 - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/version: "1.33.1" - app.kubernetes.io/managed-by: Helm -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/type: master - template: - metadata: - annotations: - checksum/config: c0bb3980c19270be5448f1677eb9ff58d0f643980e091527cb8da450033adc84 - labels: - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/type: master - - spec: - serviceAccountName: n8n - securityContext: - fsGroup: 1000 - runAsGroup: 1000 - runAsNonRoot: true - runAsUser: 1000 - containers: - - name: n8n - securityContext: - {} - image: "n8nio/n8n:1.33.1" - imagePullPolicy: IfNotPresent - env: - - - name: "N8N_PORT" #! we better set the port once again as ENV Var, see: https://community.n8n.io/t/default-config-is-not-set-or-the-port-to-be-more-precise/3158/3?u=vad1mo - value: "5678" - - name: "N8N_CONFIG_FILES" - value: "/n8n-config/config.json" - - lifecycle: - {} - ports: - - name: http - containerPort: 5678 - protocol: TCP - livenessProbe: - httpGet: - path: /healthz - port: http - readinessProbe: - httpGet: - path: /healthz - port: http - resources: - {} - volumeMounts: - - name: data - mountPath: /home/node/.n8n - - name: config-volume - mountPath: /n8n-config - volumes: - - name: "data" - emptyDir: {} - - name: config-volume - configMap: - name: n8n ---- -# Source: n8n/templates/tests/test-connection.yaml -apiVersion: v1 -kind: Pod -metadata: - name: "n8n-test-connection" - labels: - helm.sh/chart: n8n-0.23.0 - app.kubernetes.io/name: n8n - app.kubernetes.io/instance: n8n - app.kubernetes.io/version: "1.33.1" - app.kubernetes.io/managed-by: Helm - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['n8n:80'] - restartPolicy: Never