diff --git a/charts/element-web/templates/ingress.yaml b/charts/element-web/templates/ingress.yaml index 4b4f50a..797265e 100644 --- a/charts/element-web/templates/ingress.yaml +++ b/charts/element-web/templates/ingress.yaml @@ -1,9 +1,10 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "element-web.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} +{{- $v1Ingress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} +{{- if $v1Ingress -}} apiVersion: networking.k8s.io/v1 -{{- else }} +{{- else -}} apiVersion: networking.k8s.io/v1beta1 {{- end }} kind: Ingress @@ -32,18 +33,16 @@ spec: http: paths: - path: / -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Prefix -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: number: {{ $svcPort }} -{{- else }} + pathType: Prefix + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} -{{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/funkwhale/templates/ingress.yaml b/charts/funkwhale/templates/ingress.yaml index ed5ae79..cb96290 100644 --- a/charts/funkwhale/templates/ingress.yaml +++ b/charts/funkwhale/templates/ingress.yaml @@ -1,7 +1,7 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "funkwhale.fullname" . -}} ---- -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- $v1Ingress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} +{{- if $v1Ingress -}} apiVersion: networking.k8s.io/v1 {{- else -}} apiVersion: networking.k8s.io/v1beta1 @@ -34,17 +34,15 @@ spec: http: paths: - path: / -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} - pathType: Prefix -{{- end }} backend: -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: name: http -{{- else }} + pathType: Prefix + {{- else }} serviceName: {{ $fullName }} servicePort: http -{{- end }} + {{- end }} {{- end }} diff --git a/charts/matrix-media-repo/templates/ingress.yaml b/charts/matrix-media-repo/templates/ingress.yaml index 5486f33..e8ef4dd 100644 --- a/charts/matrix-media-repo/templates/ingress.yaml +++ b/charts/matrix-media-repo/templates/ingress.yaml @@ -1,7 +1,8 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "matrix-media-repo.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- $v1Ingress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} +{{- if $v1Ingress -}} apiVersion: networking.k8s.io/v1 {{- else -}} apiVersion: networking.k8s.io/v1beta1 @@ -27,25 +28,23 @@ spec: {{- end }} {{- end }} rules: - {{- range .Values.ingress.hosts }} + {{- range .Values.ingress.hosts }} - host: {{ .host | quote }} http: paths: {{- range .paths }} - path: {{ . }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific -{{- end }} backend: -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: number: {{ $svcPort }} -{{- else }} + pathType: ImplementationSpecific + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} -{{- end }} - {{- end }} + {{- end }} {{- end }} {{- end }} +{{- end }} diff --git a/charts/matrix-synapse/templates/ingress.yaml b/charts/matrix-synapse/templates/ingress.yaml index f863707..6797149 100644 --- a/charts/matrix-synapse/templates/ingress.yaml +++ b/charts/matrix-synapse/templates/ingress.yaml @@ -1,9 +1,10 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "matrix-synapse.fullname" . -}} {{- $wkName := include "matrix-synapse.externalname" (dict "global" . "external" "wellknown-lighttpd") -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} +{{- $v1Ingress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} +{{- if $v1Ingress -}} apiVersion: networking.k8s.io/v1 -{{- else }} +{{- else -}} apiVersion: networking.k8s.io/v1beta1 {{- end }} kind: Ingress @@ -59,34 +60,30 @@ spec: {{- range $config.csPaths }} {{- if $.Values.ingress.traefikPaths }} - path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }} -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $service }} port: number: 8083 -{{- else }} + pathType: ImplementationSpecific + {{- else }} serviceName: {{ $service }} servicePort: 8083 -{{- end }} + {{- end }} {{- else }} - path: {{ . | quote }} -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $service }} port: number: 8083 -{{- else }} + pathType: ImplementationSpecific + {{- else }} serviceName: {{ $service }} servicePort: 8083 -{{- end }} + {{- end }} {{- end }} {{- end }} {{- end }} @@ -94,34 +91,30 @@ spec: {{- range $config.paths }} {{- if $.Values.ingress.traefikPaths }} - path: {{ printf "/{path:%s}" (trimPrefix "/" .) | quote }} -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $service }} port: number: 8083 -{{- else }} + pathType: ImplementationSpecific + {{- else }} serviceName: {{ $service }} servicePort: 8083 -{{- end }} + {{- end }} {{- else }} - path: {{ . | quote }} -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $service }} port: number: 8083 -{{- else }} + pathType: ImplementationSpecific + {{- else }} serviceName: {{ $service }} servicePort: 8083 -{{- end }} + {{- end }} {{- end }} {{- end }} {{- end }} @@ -141,84 +134,74 @@ spec: {{- if or (has . $csHosts) (has . $s2sHosts) }} - path: /_matrix -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Prefix -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: number: 8008 -{{- else }} + pathType: Prefix + {{- else }} serviceName: {{ $fullName }} servicePort: 8008 -{{- end }} + {{- end }} {{- end }} {{- if and (has . $csHosts) $.Values.ingress.includeUnderscoreSynapse }} - path: /_synapse -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Prefix -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: number: 8008 -{{- else }} + pathType: Prefix + {{- else }} serviceName: {{ $fullName }} servicePort: 8008 -{{- end }} + {{- end }} {{- end }} {{- if has . $wkHosts }} - {{- if $.Values.wellknown.enabled }} + {{- if $.Values.wellknown.enabled }} - path: /.well-known/matrix/client -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Exact -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $wkName }} port: number: 80 -{{- else }} + pathType: Exact + {{- else }} serviceName: {{ $wkName }} servicePort: 80 -{{- end }} + {{- end }} - path: /.well-known/matrix/server -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Exact -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $wkName }} port: number: 80 -{{- else }} + pathType: Exact + {{- else }} serviceName: {{ $wkName }} servicePort: 80 -{{- end }} - {{- else }} + {{- end }} + {{- else }} - path: /.well-known/matrix/client -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: Exact -{{- end }} backend: -{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: number: 8008 -{{- else }} + pathType: Exact + {{- else }} serviceName: {{ $fullName }} servicePort: 8008 -{{- end }} - {{- end }} + {{- end }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/netbox/templates/ingress.yaml b/charts/netbox/templates/ingress.yaml index 22588fb..4a82e30 100644 --- a/charts/netbox/templates/ingress.yaml +++ b/charts/netbox/templates/ingress.yaml @@ -1,6 +1,7 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "netbox.fullname" . -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- $v1Ingress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} +{{- if $v1Ingress -}} apiVersion: networking.k8s.io/v1 {{- else -}} apiVersion: networking.k8s.io/v1beta1 @@ -36,18 +37,16 @@ spec: http: paths: - path: / -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} - pathType: Prefix -{{- end }} backend: -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: name: http -{{- else }} + pathType: Prefix + {{- else }} serviceName: {{ $fullName }} servicePort: http -{{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/radosgw/templates/ingress.yaml b/charts/radosgw/templates/ingress.yaml index ec2bf1b..60a8623 100644 --- a/charts/radosgw/templates/ingress.yaml +++ b/charts/radosgw/templates/ingress.yaml @@ -1,6 +1,7 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "radosgw.fullname" . -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- $v1Ingress := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} +{{- if $v1Ingress -}} apiVersion: networking.k8s.io/v1 {{- else -}} apiVersion: networking.k8s.io/v1beta1 @@ -30,17 +31,15 @@ spec: http: paths: - path: / -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} - pathType: Prefix -{{- end }} backend: -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + {{- if $v1Ingress }} service: name: {{ $fullName }} port: name: http -{{- else }} + pathType: Prefix + {{- else }} serviceName: {{ $fullName }} servicePort: http -{{- end }} + {{- end }} {{- end }}