{{- if and .Values.gatewayApi.enabled (eq .Values.gatewayApi.gatewayClass "traefik") }}
apiVersion: traefik.io/v1alpha1
kind: TraefikService
metadata:
  name: {{ include "rustfs.fullname" . }}-sticky-svc
  namespace: {{ .Release.Namespace }}
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: {{ .Values.ingress.tls.enabled | default false }}
            sameSite: {{ if .Values.ingress.tls.enabled }}none{{ else }}lax{{ end }}
{{- end }}
