Skip to content
Open
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
5 changes: 4 additions & 1 deletion charts/n8n/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ metadata:
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.ingress.annotations }}{{ toYaml . | nindent 4 }}{{- end }}
{{- if and .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "nginx") (hasKey (default dict .Values.ingress.annotations) "kubernetes.io/ingress.class")) }}
{{- if .Values.ingress.sticky.enabled }}
{{- $isNginx := or (eq .Values.ingress.className "nginx") (hasKey (default dict .Values.ingress.annotations) "kubernetes.io/ingress.class") }}
{{- if $isNginx }}
Comment on lines +9 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
{{- if .Values.ingress.sticky.enabled }}
{{- $isNginx := or (eq .Values.ingress.className "nginx") (hasKey (default dict .Values.ingress.annotations) "kubernetes.io/ingress.class") }}
{{- if $isNginx }}
{{- if .Values.ingress.sticky.enabled }}
{{- $legacyClass := index (default dict .Values.ingress.annotations) "kubernetes.io/ingress.class" }}
{{- $isNginx := or (eq .Values.ingress.className "nginx") (eq $legacyClass "nginx") }}
{{- if $isNginx }}

nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: {{ .Values.ingress.sticky.cookieName | quote }}
nginx.ingress.kubernetes.io/session-cookie-expires: {{ .Values.ingress.sticky.cookieExpires | quote }}
nginx.ingress.kubernetes.io/session-cookie-max-age: {{ .Values.ingress.sticky.cookieMaxAge | quote }}
{{- end }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
Expand Down
7 changes: 7 additions & 0 deletions charts/n8n/templates/service-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "n8n.labels" . | nindent 4 }}
{{- $isTraefik := and .Values.ingress.enabled .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "traefik") (hasKey (default dict .Values.ingress.annotations) "traefik.ingress.kubernetes.io/router.entrypoints")) }}

@cubic-dev-ai cubic-dev-ai Bot May 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Traefik backend detection misses the common annotation-based class (kubernetes.io/ingress.class: traefik), so sticky-session service annotations may not render for valid Traefik configurations.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At charts/n8n/templates/service-main.yaml, line 8:

<comment>Traefik backend detection misses the common annotation-based class (`kubernetes.io/ingress.class: traefik`), so sticky-session service annotations may not render for valid Traefik configurations.</comment>

<file context>
@@ -5,7 +5,14 @@ metadata:
   namespace: {{ .Release.Namespace }}
   labels:
     {{- include "n8n.labels" . | nindent 4 }}
+  {{- $isTraefik := and .Values.ingress.enabled .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "traefik") (hasKey (default dict .Values.ingress.annotations) "traefik.ingress.kubernetes.io/router.entrypoints")) }}
   {{- $merged := merge (deepCopy (.Values.service.main.annotations | default dict)) (.Values.service.annotations | default dict) }}
+  {{- if $isTraefik }}
</file context>
Suggested change
{{- $isTraefik := and .Values.ingress.enabled .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "traefik") (hasKey (default dict .Values.ingress.annotations) "traefik.ingress.kubernetes.io/router.entrypoints")) }}
{{- $isTraefik := and .Values.ingress.enabled .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "traefik") (and (hasKey (default dict .Values.ingress.annotations) "kubernetes.io/ingress.class") (eq (get (default dict .Values.ingress.annotations) "kubernetes.io/ingress.class") "traefik")) (hasKey (default dict .Values.ingress.annotations) "traefik.ingress.kubernetes.io/router.entrypoints")) }}
Fix with Cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sticky-service annotations did appear during testing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
{{- $isTraefik := and .Values.ingress.enabled .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "traefik") (hasKey (default dict .Values.ingress.annotations) "traefik.ingress.kubernetes.io/router.entrypoints")) }}
{{- $ingressAnnotations := default dict .Values.ingress.annotations }}
{{- $legacyClass := index $ingressAnnotations "kubernetes.io/ingress.class" }}
{{- $isTraefik := and .Values.ingress.enabled .Values.ingress.sticky.enabled (or (eq .Values.ingress.className "traefik") (eq $legacyClass "traefik") (hasKey $ingressAnnotations "traefik.ingress.kubernetes.io/router.entrypoints")) }}

I think this actually a valid finding. The previous check only looked for the existence of kubernetes.io/ingress.class, so a user with kubernetes.io/ingress.class: traefik would have incorrectly gotten Nginx annotations rendered on their Ingress.

{{- $merged := merge (deepCopy (.Values.service.main.annotations | default dict)) (.Values.service.annotations | default dict) }}
{{- if $isTraefik }}
{{- $_ := set $merged "traefik.ingress.kubernetes.io/service.sticky.cookie" "true" }}
{{- $_ := set $merged "traefik.ingress.kubernetes.io/service.sticky.cookie.name" .Values.ingress.sticky.cookieName }}
{{- $_ := set $merged "traefik.ingress.kubernetes.io/service.sticky.cookie.secure" (.Values.ingress.sticky.cookieSecure | toString) }}
{{- $_ := set $merged "traefik.ingress.kubernetes.io/service.sticky.cookie.httponly" "true" }}
{{- end }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
{{- end }}
{{- $_ := set $merged "traefik.ingress.kubernetes.io/service.sticky.cookie.maxage" (.Values.ingress.sticky.cookieMaxAge | toString) }}
{{- end }}

{{- with $merged }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions charts/n8n/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,12 @@
# ----- Ingress -----
ingress:
enabled: false
className: "" # supported types are "traefik" & "nginx", "traefik" is suggested as nginx-ingress is deprecated

Check failure on line 159 in charts/n8n/values.yaml

View workflow job for this annotation

GitHub Actions / lint

159:17 [comments] too few spaces before comment

@cubic-dev-ai cubic-dev-ai Bot May 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: Using className to conditionally render annotations breaks sticky sessions for users with default or custom NGINX ingress class names.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At charts/n8n/values.yaml, line 159:

<comment>Using `className` to conditionally render annotations breaks sticky sessions for users with default or custom NGINX ingress class names.</comment>

<file context>
@@ -156,9 +156,12 @@ service:
 # ----- Ingress -----
 ingress:
   enabled: false
+  className: "" # supported types are "traefik" & "nginx", "traefik" is suggested as nginx-ingress is deprecated
   sticky:
     enabled: false
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the default configuration as it existed originally

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, agreed. Users with a custom class name like "nginx-internal", etc. would have had the same behavior before this PR change.

sticky:
enabled: false
cookieName: n8n_affinity
cookieSecure: true # set to false when using plain HTTP (e.g. local minikube)
# cookieExpires and cookieMaxAge are nginx-only, these are ignored by traefik

@cubic-dev-ai cubic-dev-ai Bot May 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The comment incorrectly claims cookieMaxAge is ignored by Traefik, leading to an unimplemented feature.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At charts/n8n/values.yaml, line 164:

<comment>The comment incorrectly claims `cookieMaxAge` is ignored by Traefik, leading to an unimplemented feature.</comment>

<file context>
@@ -156,9 +156,12 @@ service:
     enabled: false
     cookieName: n8n_affinity
+    cookieSecure: true          # set to false when using plain HTTP (e.g. local minikube)
+    # cookieExpires and cookieMaxAge are nginx-only, these are ignored by traefik
     cookieExpires: "172800"  # 2 days in seconds
     cookieMaxAge: "172800"   # 2 days in seconds
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is correct according to testing, these settings were ignored.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
# cookieExpires and cookieMaxAge are nginx-only, these are ignored by traefik
# cookieExpires is nginx-only and ignored by traefik

I think what the bot wants to say is that the statement is not fully correct. cookieExpires is not support by Traefik, but cookieMaxAge is indeed supported.

cookieExpires: "172800" # 2 days in seconds
cookieMaxAge: "172800" # 2 days in seconds
hosts:
Expand Down
Loading