From 348163953bd1ae1a3bc7468938b5583be6358fc1 Mon Sep 17 00:00:00 2001 From: Ionut Balutoiu Date: Thu, 16 Nov 2023 17:34:47 +0200 Subject: [PATCH] Add Kubernetes ingress support Allow optional configuration of ingress Kubernetes resource for the main n8n service, and the webhook service. Signed-off-by: Ionut Balutoiu --- n8n/templates/ingress.yaml | 46 ++++++++++++++++++++++++++++++++++++++ n8n/values.yaml | 13 +++++++++++ 2 files changed, 59 insertions(+) create mode 100644 n8n/templates/ingress.yaml diff --git a/n8n/templates/ingress.yaml b/n8n/templates/ingress.yaml new file mode 100644 index 0000000..39948a9 --- /dev/null +++ b/n8n/templates/ingress.yaml @@ -0,0 +1,46 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: n8n + annotations: + {{- if eq .Values.ingress.className "nginx" }} + nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" + nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" + nginx.ingress.kubernetes.io/configuration-snippet: | + more_set_headers "X-Frame-Options: SAMEORIGIN"; + proxy_set_header Accept-Encoding ""; + {{- end }} + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + ingressClassName: {{ .Values.ingress.className }} + rules: + - host: {{ .Values.n8n.domainName }} + http: + paths: + {{- if eq .Values.n8n.deploymentMode "scale" }} + - path: /webhook/ + pathType: Prefix + backend: + service: + name: webhook + port: + number: 5678 + - path: /webhook-waiting/ + pathType: Prefix + backend: + service: + name: webhook + port: + number: 5678 + {{- end }} + - path: / + pathType: Prefix + backend: + service: + name: n8n + port: + number: 5678 +{{- end }} diff --git a/n8n/values.yaml b/n8n/values.yaml index 8c14ef4..3b45fcc 100644 --- a/n8n/values.yaml +++ b/n8n/values.yaml @@ -10,5 +10,18 @@ n8n: password: change-this concurrency: 20 +ingress: + enabled: false + className: nginx + annotations: {} + # + # Traefik ingress example + # + # className: traefik + # annotations: + # traefik.ingress.kubernetes.io/router.entrypoints: websecure + # traefik.ingress.kubernetes.io/router.tls: "true" + # traefik.ingress.kubernetes.io/router.tls.certresolver: le + resources: memoryLimit: 1Gi