Skip to content

Commit d33aaa7

Browse files
committed
fix annotation preset
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
1 parent e8353ea commit d33aaa7

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

charts/opencloud/templates/onlyoffice/ingress.yaml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
{{- 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+
223
apiVersion: networking.k8s.io/v1
324
kind: Ingress
425
metadata:
526
name: {{ include "opencloud.fullname" . }}-onlyoffice
627
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 }}
2529
spec:
2630
{{- if .Values.ingress.ingressClassName }}
2731
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy