charts/charts-wip/matrix-synapse/templates/ingress.yaml

126 lines
4 KiB
YAML
Raw Normal View History

2020-08-07 21:23:34 +00:00
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "matrix-synapse.fullname" . -}}
2020-08-09 09:16:36 +00:00
{{- $wkName := include "matrix-synapse.externalname" (dict "global" . "external" "wellknown-lighttpd") -}}
2020-08-07 21:23:34 +00:00
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
2020-08-09 09:16:36 +00:00
{{- $csHosts := .Values.ingress.csHosts }}
{{- if .Values.ingress.includeServerName }}
{{- $csHosts = concat (list .Values.config.serverName) $csHosts }}
2020-08-07 21:23:34 +00:00
{{- end }}
2020-08-09 09:16:36 +00:00
{{- $s2sHosts := .Values.ingress.hosts }}
{{- if .Values.ingress.includeServerName }}
{{- $s2sHosts = concat (list .Values.config.serverName) $s2sHosts }}
{{- end }}
{{- $wkHosts := .Values.ingress.wkHosts }}
{{- if .Values.ingress.includeServerName }}
{{- $wkHosts = concat (list .Values.config.serverName) $wkHosts }}
{{- end }}
{{- $hosts := uniq (concat $s2sHosts $csHosts $wkHosts) }}
2020-08-07 21:23:34 +00:00
{{- range $hosts }}
2020-08-09 09:16:36 +00:00
{{- $host := . }}
2020-08-07 21:23:34 +00:00
- host: {{ . | quote }}
http:
paths:
{{- $default := $.Values.workers.default }}
{{- range $worker, $config := $.Values.workers }}
{{- $name := $worker | replace "_" "-" }}
2020-08-09 09:16:36 +00:00
{{- if and $config.enabled $config.listeners (or $config.paths $config.csPaths) }}
2020-08-07 21:23:34 +00:00
{{- $service := include "matrix-synapse.workername" (dict "global" $ "worker" $name) }}
2020-08-09 09:16:36 +00:00
{{- if has $host $csHosts }}
{{- range $config.csPaths }}
{{- if $.Values.ingress.traefikPaths }}
- path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }}
backend:
serviceName: {{ $service }}
servicePort: 8083
{{- else }}
- path: {{ . | quote }}
backend:
serviceName: {{ $service }}
servicePort: 8083
{{- end }}
{{- end }}
{{- end }}
{{- if has $host $s2sHosts }}
{{- range $config.paths }}
{{- if $.Values.ingress.traefikPaths }}
2020-08-07 21:23:34 +00:00
- path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }}
backend:
serviceName: {{ $service }}
servicePort: 8083
2020-08-09 09:16:36 +00:00
{{- else }}
2020-08-07 21:23:34 +00:00
- path: {{ . | quote }}
backend:
serviceName: {{ $service }}
servicePort: 8083
2020-08-09 09:16:36 +00:00
{{- end }}
2020-08-07 21:23:34 +00:00
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2020-08-09 09:16:36 +00:00
{{- if has . $csHosts }}
{{- with $.Values.ingress.csPaths }}
{{ . | toYaml | nindent 10 }}
{{- end }}
{{- end }}
{{- if has . $s2sHosts }}
2020-08-08 22:15:10 +00:00
{{- with $.Values.ingress.paths }}
{{ . | toYaml | nindent 10 }}
{{- end }}
2020-08-09 09:16:36 +00:00
{{- end }}
2020-08-08 22:15:10 +00:00
2020-08-09 09:16:36 +00:00
{{- if or (has . $csHosts) (has . $s2sHosts) }}
2020-08-07 21:23:34 +00:00
- path: /_matrix
backend:
serviceName: {{ $fullName }}
servicePort: 8008
2020-08-09 09:16:36 +00:00
{{- end }}
2020-08-07 21:23:34 +00:00
2020-08-09 09:16:36 +00:00
{{- if and (has . $csHosts) $.Values.ingress.includeUnderscoreSynapse }}
2020-08-08 22:15:10 +00:00
- path: /_synapse
backend:
serviceName: {{ $fullName }}
servicePort: 8008
{{- end }}
2020-08-09 09:16:36 +00:00
{{- if has . $wkHosts }}
2020-08-07 21:23:34 +00:00
- path: /.well-known/matrix/client
backend:
serviceName: {{ $fullName }}
servicePort: 8008
{{- if $.Values.wellknown.enabled }}
- path: /.well-known/matrix/server
backend:
serviceName: {{ $wkName }}
servicePort: 80
{{- end }}
2020-08-09 09:16:36 +00:00
{{- end }}
2020-08-07 21:23:34 +00:00
{{- end }}
{{- end }}