From 466429b95830dbf626bf493c0b2be7a6b6c1d996 Mon Sep 17 00:00:00 2001 From: majinghe <42570491+majinghe@users.noreply.github.com> Date: Thu, 5 Feb 2026 21:04:18 +0800 Subject: [PATCH] feat: add contour as ingress controller with http proxy (#1729) Co-authored-by: houseme --- helm/rustfs/templates/contour-http-proxy.yaml | 37 +++++++++++++++++++ .../templates/gateway-api/httproute.yml | 17 +++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 helm/rustfs/templates/contour-http-proxy.yaml diff --git a/helm/rustfs/templates/contour-http-proxy.yaml b/helm/rustfs/templates/contour-http-proxy.yaml new file mode 100644 index 000000000..aec7e5749 --- /dev/null +++ b/helm/rustfs/templates/contour-http-proxy.yaml @@ -0,0 +1,37 @@ +{{- if eq .Values.ingress.className "contour" }} +apiVersion: projectcontour.io/v1 +kind: HTTPProxy +metadata: + name: {{ include "rustfs.fullname" . }}-proxy + labels: + {{- include "rustfs.labels" . | nindent 4 }} + {{- with .Values.commonLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +spec: + {{- range .Values.ingress.hosts }} + virtualhost: + fqdn: {{ .host | quote }} + {{- if $.Values.ingress.tls.enabled }} + tls: + secretName: {{ include "rustfs.fullname" $ }}-tls + {{- end }} + routes: + - conditions: + {{- range .paths }} + - prefix: {{ .path }} + {{- end }} + services: + - name: {{ include "rustfs.fullname" $ }}-svc + port: {{ $.Values.service.console.port }} + loadBalancerPolicy: + strategy: Cookie + timeoutPolicy: + response: infinity + idle: 5m + {{- if $.Values.ingress.tls.enabled }} + permitInsecure: true + {{- end }} + {{- end }} +{{- end }} diff --git a/helm/rustfs/templates/gateway-api/httproute.yml b/helm/rustfs/templates/gateway-api/httproute.yml index 3b6d6f196..74ff2d2fc 100644 --- a/helm/rustfs/templates/gateway-api/httproute.yml +++ b/helm/rustfs/templates/gateway-api/httproute.yml @@ -1,8 +1,12 @@ -{{- if and .Values.gatewayApi.enabled (eq .Values.gatewayApi.gatewayClass "traefik") }} +{{- if .Values.gatewayApi.enabled }} apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: {{ include "rustfs.fullname" . }}-route + annotations: + {{- if eq .Values.gatewayApi.gatewayClass "contour" }} + projectcontour.io/upstream-hash-policy: "cookie" + {{- end }} spec: parentRefs: {{- if .Values.gatewayApi.existingGateway.name }} @@ -12,7 +16,7 @@ spec: {{- end }} sectionName: https {{- else }} - - name: {{ include "rustfs.fullname" . }}-gateway + - name: {{ include "rustfs.fullname" $ }}-gateway sectionName: https {{- end }} hostnames: @@ -23,10 +27,15 @@ spec: type: PathPrefix value: / backendRefs: + {{- if eq .Values.gatewayApi.gatewayClass "traefik" }} - name: {{ include "rustfs.fullname" . }}-sticky-svc port: {{ .Values.service.console.port }} kind: TraefikService group: traefik.io + {{- else if eq .Values.gatewayApi.gatewayClass "contour" }} + - name: {{ include "rustfs.fullname" $ }}-svc + port: {{ .Values.service.console.port }} + {{- end }} --- apiVersion: gateway.networking.k8s.io/v1 @@ -42,7 +51,7 @@ spec: {{- end }} sectionName: http {{- else }} - - name: {{ include "rustfs.fullname" . }}-gateway + - name: {{ include "rustfs.fullname" $ }}-gateway sectionName: http {{- end }} rules: @@ -51,4 +60,4 @@ spec: requestRedirect: scheme: https statusCode: 301 -{{- end }} \ No newline at end of file +{{- end }}