From 57c1a57c67a2b1e6d78b757cb18e3f28e9c3c000 Mon Sep 17 00:00:00 2001 From: matiaszilli Date: Fri, 1 Aug 2025 09:15:36 +0200 Subject: [PATCH 1/3] feat: implement terminationGracePeriodSeconds for all pods --- charts/n8n/templates/deployment.webhook.yaml | 3 +++ charts/n8n/templates/deployment.worker.yaml | 3 +++ charts/n8n/templates/deployment.yaml | 3 +++ charts/n8n/values.yaml | 9 +++++++++ 4 files changed, 18 insertions(+) diff --git a/charts/n8n/templates/deployment.webhook.yaml b/charts/n8n/templates/deployment.webhook.yaml index 5dc22fc..3d54943 100644 --- a/charts/n8n/templates/deployment.webhook.yaml +++ b/charts/n8n/templates/deployment.webhook.yaml @@ -134,6 +134,9 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.webhook.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.webhook.terminationGracePeriodSeconds }} + {{- end }} volumes: - name: "data" {{ include "n8n.pvc" . }} diff --git a/charts/n8n/templates/deployment.worker.yaml b/charts/n8n/templates/deployment.worker.yaml index 13d7a8d..987653e 100644 --- a/charts/n8n/templates/deployment.worker.yaml +++ b/charts/n8n/templates/deployment.worker.yaml @@ -130,6 +130,9 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.worker.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.worker.terminationGracePeriodSeconds }} + {{- end }} volumes: - name: "data" {{ include "n8n.pvc" . }} diff --git a/charts/n8n/templates/deployment.yaml b/charts/n8n/templates/deployment.yaml index 523df2b..0fca5d4 100644 --- a/charts/n8n/templates/deployment.yaml +++ b/charts/n8n/templates/deployment.yaml @@ -115,6 +115,9 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.main.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.main.terminationGracePeriodSeconds }} + {{- end }} volumes: - name: "data" {{ include "n8n.pvc" . }} diff --git a/charts/n8n/values.yaml b/charts/n8n/values.yaml index 7c1b25a..e037b14 100644 --- a/charts/n8n/values.yaml +++ b/charts/n8n/values.yaml @@ -266,6 +266,9 @@ main: tolerations: [] affinity: {} + # Pod termination grace period in seconds + terminationGracePeriodSeconds: 30 + # # # # # # # # # # # # # # # # # # Worker related settings @@ -451,6 +454,9 @@ worker: tolerations: [] affinity: {} + # Pod termination grace period in seconds + terminationGracePeriodSeconds: 30 + # Webhook related settings # With .Values.scaling.webhook.enabled=true you disable Webhooks from the main process, but you enable the processing on a different Webhook instance. # See https://github.com/8gears/n8n-helm-chart/issues/39#issuecomment-1579991754 for the full explanation. @@ -636,6 +642,9 @@ webhook: tolerations: [] affinity: {} + # Pod termination grace period in seconds + terminationGracePeriodSeconds: 30 + # # User defined supplementary K8s manifests # From c79f0b4306ecc94e981d79ee45bd4b8d6e802a47 Mon Sep 17 00:00:00 2001 From: matiaszilli Date: Fri, 1 Aug 2025 09:36:19 +0200 Subject: [PATCH 2/3] fix: implement hasKey which respects zero value --- charts/n8n/templates/deployment.webhook.yaml | 2 +- charts/n8n/templates/deployment.worker.yaml | 2 +- charts/n8n/templates/deployment.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/n8n/templates/deployment.webhook.yaml b/charts/n8n/templates/deployment.webhook.yaml index 3d54943..117fe17 100644 --- a/charts/n8n/templates/deployment.webhook.yaml +++ b/charts/n8n/templates/deployment.webhook.yaml @@ -134,7 +134,7 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.webhook.terminationGracePeriodSeconds }} + {{- if hasKey .Values.webhook "terminationGracePeriodSeconds" }} terminationGracePeriodSeconds: {{ .Values.webhook.terminationGracePeriodSeconds }} {{- end }} volumes: diff --git a/charts/n8n/templates/deployment.worker.yaml b/charts/n8n/templates/deployment.worker.yaml index 987653e..892bb8f 100644 --- a/charts/n8n/templates/deployment.worker.yaml +++ b/charts/n8n/templates/deployment.worker.yaml @@ -130,7 +130,7 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.worker.terminationGracePeriodSeconds }} + {{- if hasKey .Values.worker "terminationGracePeriodSeconds" }} terminationGracePeriodSeconds: {{ .Values.worker.terminationGracePeriodSeconds }} {{- end }} volumes: diff --git a/charts/n8n/templates/deployment.yaml b/charts/n8n/templates/deployment.yaml index 0fca5d4..5426563 100644 --- a/charts/n8n/templates/deployment.yaml +++ b/charts/n8n/templates/deployment.yaml @@ -115,7 +115,7 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.main.terminationGracePeriodSeconds }} + {{- if hasKey .Values.main "terminationGracePeriodSeconds" }} terminationGracePeriodSeconds: {{ .Values.main.terminationGracePeriodSeconds }} {{- end }} volumes: From 9103fcac2b4934351e620b15e38267b33ef746a8 Mon Sep 17 00:00:00 2001 From: matiaszilli Date: Mon, 25 Aug 2025 10:50:08 +0100 Subject: [PATCH 3/3] chore: update readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 089f23d..63722eb 100644 --- a/README.md +++ b/README.md @@ -359,6 +359,9 @@ main: tolerations: [] affinity: {} + # Pod termination grace period in seconds + terminationGracePeriodSeconds: 30 + # # # # # # # # # # # # # # # # # # Worker related settings @@ -544,6 +547,9 @@ worker: tolerations: [] affinity: {} + # Pod termination grace period in seconds + terminationGracePeriodSeconds: 30 + # Webhook related settings # With .Values.scaling.webhook.enabled=true you disable Webhooks from the main process, but you enable the processing on a different Webhook instance. # See https://github.com/8gears/n8n-helm-chart/issues/39#issuecomment-1579991754 for the full explanation. @@ -729,6 +735,9 @@ webhook: tolerations: [] affinity: {} + # Pod termination grace period in seconds + terminationGracePeriodSeconds: 30 + # # User defined supplementary K8s manifests #