From 16c2b8b648cdbe126b0daf3184242d5dbca73290 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Fri, 3 Sep 2021 09:47:02 +0200 Subject: [PATCH] Use modern ingress API correctly --- charts/element-web/templates/ingress.yaml | 6 +++ charts/funkwhale/templates/ingress.yaml | 6 +++ .../matrix-media-repo/templates/ingress.yaml | 6 +++ charts/matrix-synapse/templates/ingress.yaml | 54 +++++++++++++++++++ charts/netbox/templates/ingress.yaml | 6 +++ charts/radosgw/templates/ingress.yaml | 6 +++ 6 files changed, 84 insertions(+) diff --git a/charts/element-web/templates/ingress.yaml b/charts/element-web/templates/ingress.yaml index 3b2fff5..840d9f6 100644 --- a/charts/element-web/templates/ingress.yaml +++ b/charts/element-web/templates/ingress.yaml @@ -33,7 +33,13 @@ spec: paths: - path: / backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: {{ $svcPort }} +{{- else -}} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} +{{- end -}} {{- end }} {{- end }} diff --git a/charts/funkwhale/templates/ingress.yaml b/charts/funkwhale/templates/ingress.yaml index 3b549ac..2cc1a14 100644 --- a/charts/funkwhale/templates/ingress.yaml +++ b/charts/funkwhale/templates/ingress.yaml @@ -35,6 +35,12 @@ spec: paths: - path: / backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: http +{{- else -}} serviceName: {{ $fullName }} servicePort: http +{{- end -}} {{- end }} diff --git a/charts/matrix-media-repo/templates/ingress.yaml b/charts/matrix-media-repo/templates/ingress.yaml index 7cd4998..9aa11fd 100644 --- a/charts/matrix-media-repo/templates/ingress.yaml +++ b/charts/matrix-media-repo/templates/ingress.yaml @@ -34,8 +34,14 @@ spec: {{- range .paths }} - path: {{ . }} backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: {{ $svcPort }} +{{- else -}} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} +{{- end -}} {{- end }} {{- end }} {{- end }} diff --git a/charts/matrix-synapse/templates/ingress.yaml b/charts/matrix-synapse/templates/ingress.yaml index 3a8749a..bd28613 100644 --- a/charts/matrix-synapse/templates/ingress.yaml +++ b/charts/matrix-synapse/templates/ingress.yaml @@ -60,13 +60,25 @@ spec: {{- if $.Values.ingress.traefikPaths }} - path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }} backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $service }} + port: 8083 +{{- else -}} serviceName: {{ $service }} servicePort: 8083 +{{- end -}} {{- else }} - path: {{ . | quote }} backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $service }} + port: 8083 +{{- else -}} serviceName: {{ $service }} servicePort: 8083 +{{- end -}} {{- end }} {{- end }} {{- end }} @@ -75,13 +87,25 @@ spec: {{- if $.Values.ingress.traefikPaths }} - path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }} backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $service }} + port: 8083 +{{- else -}} serviceName: {{ $service }} servicePort: 8083 +{{- end -}} {{- else }} - path: {{ . | quote }} backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $service }} + port: 8083 +{{- else -}} serviceName: {{ $service }} servicePort: 8083 +{{- end -}} {{- end }} {{- end }} {{- end }} @@ -102,32 +126,62 @@ spec: {{- if or (has . $csHosts) (has . $s2sHosts) }} - path: /_matrix backend: +{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: 8008 +{{- else -}} serviceName: {{ $fullName }} servicePort: 8008 +{{- end -}} {{- end }} {{- if and (has . $csHosts) $.Values.ingress.includeUnderscoreSynapse }} - path: /_synapse backend: +{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: 8008 +{{- else -}} serviceName: {{ $fullName }} servicePort: 8008 +{{- end -}} {{- end }} {{- if has . $wkHosts }} {{- if $.Values.wellknown.enabled }} - path: /.well-known/matrix/client backend: +{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $wkName }} + port: 80 +{{- else -}} serviceName: {{ $wkName }} servicePort: 80 +{{- end -}} - path: /.well-known/matrix/server backend: +{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $wkName }} + port: 80 +{{- else -}} serviceName: {{ $wkName }} servicePort: 80 +{{- end -}} {{- else }} - path: /.well-known/matrix/client backend: +{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: 8008 +{{- else -}} serviceName: {{ $fullName }} servicePort: 8008 +{{- end -}} {{- end }} {{- end }} {{- end }} diff --git a/charts/netbox/templates/ingress.yaml b/charts/netbox/templates/ingress.yaml index a847cd5..a80423f 100644 --- a/charts/netbox/templates/ingress.yaml +++ b/charts/netbox/templates/ingress.yaml @@ -37,7 +37,13 @@ spec: paths: - path: / backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: http +{{- else -}} serviceName: {{ $fullName }} servicePort: http +{{- end -}} {{- end }} {{- end }} diff --git a/charts/radosgw/templates/ingress.yaml b/charts/radosgw/templates/ingress.yaml index 144ee9a..7ec545b 100644 --- a/charts/radosgw/templates/ingress.yaml +++ b/charts/radosgw/templates/ingress.yaml @@ -31,6 +31,12 @@ spec: paths: - path: / backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + service: + name: {{ $fullName }} + port: http +{{- else -}} serviceName: {{ $fullName }} servicePort: http +{{- end -}} {{- end }}