File tree Expand file tree Collapse file tree 3 files changed +63
-0
lines changed
Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,14 @@ yProvider:
141141 COLLABORATION_SERVER_SECRET: my-secret
142142 Y_PROVIDER_API_KEY: my-secret
143143
144+ ingressRedirects:
145+ enabled: true
146+ defaultHost: {{ .Values.feature }}-docs.{{ .Values.domain }}
147+ rules:
148+ - name: home
149+ from: /home
150+ to: https://lasuite.numerique.gouv.fr/produits/docs
151+
144152ingress:
145153 enabled: true
146154 host: {{ .Values.feature }}-docs.{{ .Values.domain }}
Original file line number Diff line number Diff line change 1+ {{- if and .Values.ingress.enabled .Values.ingressRedirects.enabled }}
2+ {{- $fullName := include "impress.fullname" . -}}
3+ {{- $ns := .Release.Namespace -}}
4+ {{- $class := .Values.ingress.className -}}
5+ {{- $defaultHost := .Values.ingressRedirects.defaultHost | default .Values.ingress.host -}}
6+
7+ {{- range $i, $r := .Values.ingressRedirects.rules }}
8+ {{- $host := $r.host | default $defaultHost -}}
9+ {{- $from := $r.from | default "/home" -}}
10+ {{- $to := required (printf "ingressRedirects.rules[%d].to is required" $i) $r.to -}}
11+ {{- $name := printf "%s-redirect-%s" $fullName (replace "/" "-" (trimAll "/" $from)) | trunc 63 | trimSuffix "-" -}}
12+
13+ apiVersion : networking.k8s.io/v1
14+ kind : Ingress
15+ metadata :
16+ name : {{ $name }}
17+ namespace : {{ $ns }}
18+ annotations :
19+ {{- if or (not $r.code) (eq (toString $r.code) "301") }}
20+ nginx.ingress.kubernetes.io/permanent-redirect : " {{ $to }}"
21+ {{- else }}
22+ nginx.ingress.kubernetes.io/configuration-snippet : |
23+ return {{ $r.code }} {{ $to }};
24+ {{- end }}
25+ spec :
26+ {{- if $class }}
27+ ingressClassName : {{ $class }}
28+ {{- end }}
29+ rules :
30+ - host : {{ $host }}
31+ http :
32+ paths :
33+ - path : {{ $from }}
34+ pathType : Exact
35+ backend :
36+ service :
37+ name : {{ include "impress.frontend.fullname" $ }}
38+ port :
39+ number : {{ $.Values.frontend.service.port }}
40+ - path : {{ printf "%s/" (trimSuffix "/" $from) }}
41+ pathType : Exact
42+ backend :
43+ service :
44+ name : {{ include "impress.frontend.fullname" $ }}
45+ port :
46+ number : {{ $.Values.frontend.service.port }}
47+ ---
48+ {{- end }}
49+ {{- end }}
Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ ingressCollaborationWS:
8585 nginx.ingress.kubernetes.io/proxy-send-timeout : " 86400"
8686 nginx.ingress.kubernetes.io/upstream-hash-by : $arg_room
8787
88+ ingressRedirects :
89+ enabled : false
90+ namePrefix : impress-redir
91+ defaultHost : impress.example.com
92+ rules : []
93+
8894# # @param ingressCollaborationApi.enabled whether to enable the Ingress or not
8995# # @param ingressCollaborationApi.className IngressClass to use for the Ingress
9096# # @param ingressCollaborationApi.host Host for the Ingress
You can’t perform that action at this time.
0 commit comments