From e87ca48e03de2276872267a5e82ebff7217c7242 Mon Sep 17 00:00:00 2001 From: "macarena.poisson" Date: Tue, 22 Feb 2022 09:56:08 -0300 Subject: [PATCH 1/2] support for k8s v1.22 and backwards compatibility --- .../templates/ingress.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/charts/dex-k8s-authenticator/templates/ingress.yaml b/charts/dex-k8s-authenticator/templates/ingress.yaml index 54c0fa96..71f51a65 100644 --- a/charts/dex-k8s-authenticator/templates/ingress.yaml +++ b/charts/dex-k8s-authenticator/templates/ingress.yaml @@ -2,7 +2,13 @@ {{- $fullName := include "dex-k8s-authenticator.fullname" . -}} {{- $servicePort := .Values.service.port -}} {{- $ingressPath := .Values.ingress.path -}} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: networking.k8s.io/v1beta1 +{{- else }} apiVersion: extensions/v1beta1 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} @@ -17,6 +23,9 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} spec: +{{- if .Values.ingress.className and (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} +{{- end }} {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} @@ -33,8 +42,18 @@ spec: http: paths: - path: {{ $ingressPath }} + {{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion }} + pathType: ImplementationSpecific + {{- end }} backend: + {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $servicePort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $servicePort }} + {{- end }} {{- end }} {{- end }} From 9b8d35b72b3b2043841c5e90fe3914f3f053a27b Mon Sep 17 00:00:00 2001 From: Maqui-LP Date: Tue, 22 Feb 2022 11:20:44 -0300 Subject: [PATCH 2/2] fix ingress --- charts/dex-k8s-authenticator/templates/ingress.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/dex-k8s-authenticator/templates/ingress.yaml b/charts/dex-k8s-authenticator/templates/ingress.yaml index 71f51a65..7f669164 100644 --- a/charts/dex-k8s-authenticator/templates/ingress.yaml +++ b/charts/dex-k8s-authenticator/templates/ingress.yaml @@ -23,7 +23,7 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} spec: -{{- if .Values.ingress.className and (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} +{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ingress.className }} {{- end }} {{- if .Values.ingress.tls }} @@ -42,11 +42,11 @@ spec: http: paths: - path: {{ $ingressPath }} - {{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion }} + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} pathType: ImplementationSpecific {{- end }} backend: - {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: name: {{ $fullName }} port: