From 1c085590cac220764d010615f933153ff941d444 Mon Sep 17 00:00:00 2001 From: majinghe <42570491+majinghe@users.noreply.github.com> Date: Fri, 30 Jan 2026 12:34:31 +0800 Subject: [PATCH] fix: traefik gateway api support with sticky session (#1660) Co-authored-by: houseme --- helm/rustfs/templates/gateway-api/gateway.yml | 2 +- .../templates/gateway-api/httproute.yml | 10 ++++++---- .../gateway-api/traefik-service.yaml | 19 +++++++++++++++++++ helm/rustfs/templates/secret-tls.yaml | 2 +- helm/rustfs/values.yaml | 1 - 5 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 helm/rustfs/templates/gateway-api/traefik-service.yaml diff --git a/helm/rustfs/templates/gateway-api/gateway.yml b/helm/rustfs/templates/gateway-api/gateway.yml index fde30aa12..d6a0a60a8 100644 --- a/helm/rustfs/templates/gateway-api/gateway.yml +++ b/helm/rustfs/templates/gateway-api/gateway.yml @@ -18,6 +18,6 @@ spec: tls: mode: Terminate certificateRefs: - - name: {{ .Values.gatewayApi.secretName }} + - name: {{ .Values.ingress.tls.secretName }} kind: Secret {{- end }} diff --git a/helm/rustfs/templates/gateway-api/httproute.yml b/helm/rustfs/templates/gateway-api/httproute.yml index edd0b5177..24ac4e473 100644 --- a/helm/rustfs/templates/gateway-api/httproute.yml +++ b/helm/rustfs/templates/gateway-api/httproute.yml @@ -1,4 +1,4 @@ -{{- if .Values.gatewayApi.enabled -}} +{{- if and .Values.gatewayApi.enabled (eq .Values.gatewayApi.gatewayClass "traefik") }} apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: @@ -21,6 +21,8 @@ spec: type: PathPrefix value: / backendRefs: - - name: rustfs-svc - port: 9001 -{{- end }} + - name: {{ include "rustfs.fullname" . }}-sticky-svc + port: {{ .Values.service.console.port }} + kind: TraefikService + group: traefik.io +{{- end }} \ No newline at end of file diff --git a/helm/rustfs/templates/gateway-api/traefik-service.yaml b/helm/rustfs/templates/gateway-api/traefik-service.yaml new file mode 100644 index 000000000..2934c9ab1 --- /dev/null +++ b/helm/rustfs/templates/gateway-api/traefik-service.yaml @@ -0,0 +1,19 @@ +{{- if eq .Values.gatewayApi.gatewayClass "traefik" }} +apiVersion: traefik.io/v1alpha1 +kind: TraefikService +metadata: + name: {{ include "rustfs.fullname" . }}-sticky-svc +spec: + weighted: + services: + - name: {{ include "rustfs.fullname" . }}-svc + namespace: {{ .Release.Namespace }} + port: {{ .Values.service.console.port }} + weight: 1 + sticky: + cookie: + name: rustfs + httpOnly: true + secure: true + sameSite: none +{{- end }} diff --git a/helm/rustfs/templates/secret-tls.yaml b/helm/rustfs/templates/secret-tls.yaml index 730f5766d..b271ee4b5 100644 --- a/helm/rustfs/templates/secret-tls.yaml +++ b/helm/rustfs/templates/secret-tls.yaml @@ -1,4 +1,4 @@ -{{- if and (or .Values.gatewayApi.enabled .Values.ingress.tls.enabled) (not (or .Values.ingress.tls.certManager.enabled .Values.gatewayApi.existingGateway.name)) }} +{{- if .Values.ingress.tls.enabled -}} apiVersion: v1 kind: Secret metadata: diff --git a/helm/rustfs/values.yaml b/helm/rustfs/values.yaml index 3a4794af8..30ce75a10 100644 --- a/helm/rustfs/values.yaml +++ b/helm/rustfs/values.yaml @@ -141,7 +141,6 @@ gatewayApi: enabled: false gatewayClass: traefik hostname: example.rustfs.com - secretName: secret-tls existingGateway: name: "" namespace: ""