Use modern ingress API correctly

This commit is contained in:
Alexander Olofsson 2021-09-03 09:47:02 +02:00
parent 8cc046b346
commit 16c2b8b648
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
6 changed files with 84 additions and 0 deletions

View file

@ -33,7 +33,13 @@ spec:
paths: paths:
- path: / - path: /
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: {{ $svcPort }}
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: {{ $svcPort }} servicePort: {{ $svcPort }}
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -35,6 +35,12 @@ spec:
paths: paths:
- path: / - path: /
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: http
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: http servicePort: http
{{- end -}}
{{- end }} {{- end }}

View file

@ -34,8 +34,14 @@ spec:
{{- range .paths }} {{- range .paths }}
- path: {{ . }} - path: {{ . }}
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: {{ $svcPort }}
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: {{ $svcPort }} servicePort: {{ $svcPort }}
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -60,13 +60,25 @@ spec:
{{- if $.Values.ingress.traefikPaths }} {{- if $.Values.ingress.traefikPaths }}
- path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }} - path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }}
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $service }}
port: 8083
{{- else -}}
serviceName: {{ $service }} serviceName: {{ $service }}
servicePort: 8083 servicePort: 8083
{{- end -}}
{{- else }} {{- else }}
- path: {{ . | quote }} - path: {{ . | quote }}
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $service }}
port: 8083
{{- else -}}
serviceName: {{ $service }} serviceName: {{ $service }}
servicePort: 8083 servicePort: 8083
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
@ -75,13 +87,25 @@ spec:
{{- if $.Values.ingress.traefikPaths }} {{- if $.Values.ingress.traefikPaths }}
- path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }} - path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }}
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $service }}
port: 8083
{{- else -}}
serviceName: {{ $service }} serviceName: {{ $service }}
servicePort: 8083 servicePort: 8083
{{- end -}}
{{- else }} {{- else }}
- path: {{ . | quote }} - path: {{ . | quote }}
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $service }}
port: 8083
{{- else -}}
serviceName: {{ $service }} serviceName: {{ $service }}
servicePort: 8083 servicePort: 8083
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
@ -102,32 +126,62 @@ spec:
{{- if or (has . $csHosts) (has . $s2sHosts) }} {{- if or (has . $csHosts) (has . $s2sHosts) }}
- path: /_matrix - path: /_matrix
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: 8008
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: 8008 servicePort: 8008
{{- end -}}
{{- end }} {{- end }}
{{- if and (has . $csHosts) $.Values.ingress.includeUnderscoreSynapse }} {{- if and (has . $csHosts) $.Values.ingress.includeUnderscoreSynapse }}
- path: /_synapse - path: /_synapse
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: 8008
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: 8008 servicePort: 8008
{{- end -}}
{{- end }} {{- end }}
{{- if has . $wkHosts }} {{- if has . $wkHosts }}
{{- if $.Values.wellknown.enabled }} {{- if $.Values.wellknown.enabled }}
- path: /.well-known/matrix/client - path: /.well-known/matrix/client
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $wkName }}
port: 80
{{- else -}}
serviceName: {{ $wkName }} serviceName: {{ $wkName }}
servicePort: 80 servicePort: 80
{{- end -}}
- path: /.well-known/matrix/server - path: /.well-known/matrix/server
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $wkName }}
port: 80
{{- else -}}
serviceName: {{ $wkName }} serviceName: {{ $wkName }}
servicePort: 80 servicePort: 80
{{- end -}}
{{- else }} {{- else }}
- path: /.well-known/matrix/client - path: /.well-known/matrix/client
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: 8008
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: 8008 servicePort: 8008
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -37,7 +37,13 @@ spec:
paths: paths:
- path: / - path: /
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: http
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: http servicePort: http
{{- end -}}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -31,6 +31,12 @@ spec:
paths: paths:
- path: / - path: /
backend: backend:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
service:
name: {{ $fullName }}
port: http
{{- else -}}
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: http servicePort: http
{{- end -}}
{{- end }} {{- end }}