|
1 | 1 | {{- if and .Values.ingress.enabled .Values.onlyoffice.enabled }}
|
| 2 | +# toYaml and manually added key: value pairs cannot be used in the same annotations block, |
| 3 | +# so we use a dict to build all annotations and pass them through toYaml once: |
| 4 | +{{- $annotations := dict }} |
| 5 | +{{- $_ := mergeOverwrite $annotations .Values.ingress.annotations }} |
| 6 | +{{- if eq .Values.ingress.annotationsPreset "traefik" }} |
| 7 | + # Traefik: attach our pre-defined Middleware |
| 8 | + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s-add-x-forwarded-proto-https@kubernetescrd" .Release.Namespace) }} |
| 9 | +{{- else if eq .Values.ingress.annotationsPreset "nginx" }} |
| 10 | + # NGINX: inject custom header via configuration-snippet |
| 11 | + {{- $_ := set $annotations "nginx.ingress.kubernetes.io/configuration-snippet" "more_set_headers \"X-Forwarded-Proto: https\";" }} |
| 12 | +{{- else if eq .Values.ingress.annotationsPreset "haproxy" }} |
| 13 | + # HAProxy: inject custom header via request-set-headers |
| 14 | + {{- $_ := set $annotations "haproxy.ingress.kubernetes.io/request-set-headers" "X-Forwarded-Proto https" }} |
| 15 | +{{- else if eq .Values.ingress.annotationsPreset "contour" }} |
| 16 | + # Contour: inject custom header via request-add |
| 17 | + {{- $_ := set $annotations "projectcontour.io/request-add" "X-Forwarded-Proto: https" }} |
| 18 | +{{- else if eq .Values.ingress.annotationsPreset "istio" }} |
| 19 | + # Istio: inject custom header via EnvoyFilter |
| 20 | + {{- $_ := set $annotations "istio.io/request-headers" "X-Forwarded-Proto: https" }} |
| 21 | +{{- end }} |
| 22 | + |
2 | 23 | apiVersion: networking.k8s.io/v1
|
3 | 24 | kind: Ingress
|
4 | 25 | metadata:
|
5 | 26 | name: {{ include "opencloud.fullname" . }}-onlyoffice
|
6 | 27 | annotations:
|
7 |
| - {{- toYaml .Values.ingress.annotations | nindent 4 }} |
8 |
| - {{- if eq .Values.ingress.annotationsPreset "traefik" }} |
9 |
| - # Traefik: attach our pre-defined Middleware |
10 |
| - traefik.ingress.kubernetes.io/router.middlewares: {{ .Release.Namespace }}-add-x-forwarded-proto-https@kubernetescrd |
11 |
| - {{- else if eq .Values.ingress.annotationsPreset "nginx" }} |
12 |
| - # NGINX: inject custom header via configuration-snippet |
13 |
| - nginx.ingress.kubernetes.io/configuration-snippet: | |
14 |
| - more_set_headers "X-Forwarded-Proto: https"; |
15 |
| - {{- else if eq .Values.ingress.annotationsPreset "haproxy" }} |
16 |
| - # HAProxy: inject custom header via request-set-headers |
17 |
| - haproxy.ingress.kubernetes.io/request-set-headers: "X-Forwarded-Proto https" |
18 |
| - {{- else if eq .Values.ingress.annotationsPreset "contour" }} |
19 |
| - # Contour: inject custom header via request-add |
20 |
| - projectcontour.io/request-add: "X-Forwarded-Proto: https" |
21 |
| - {{- else if eq .Values.ingress.annotationsPreset "istio" }} |
22 |
| - # Istio: inject custom header via EnvoyFilter |
23 |
| - istio.io/request-headers: "X-Forwarded-Proto: https" |
24 |
| - {{- end }} |
| 28 | + {{- toYaml $annotations | nindent 4 }} |
25 | 29 | spec:
|
26 | 30 | {{- if .Values.ingress.ingressClassName }}
|
27 | 31 | ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
|
|
0 commit comments