From 5a36627aae7d8772f4190453dc8aae5da7e73104 Mon Sep 17 00:00:00 2001 From: jlandowner Date: Sat, 25 Sep 2021 23:07:06 +0900 Subject: [PATCH] Use Ingress v1 from k8s v1.19 --- ci/helm-chart/templates/ingress.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ci/helm-chart/templates/ingress.yaml b/ci/helm-chart/templates/ingress.yaml index 07a3abd0b..d0a552cdf 100644 --- a/ci/helm-chart/templates/ingress.yaml +++ b/ci/helm-chart/templates/ingress.yaml @@ -1,7 +1,9 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "code-server.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- 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 @@ -27,6 +29,22 @@ spec: {{- end }} {{- end }} rules: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + pathType: Prefix + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} + {{- else -}} {{- range .Values.ingress.hosts }} - host: {{ .host | quote }} http: @@ -39,3 +57,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file