From 63bc10e39346ab33d7382d9667ed13d60549f531 Mon Sep 17 00:00:00 2001 From: luhahn Date: Thu, 26 Nov 2020 17:01:16 +0800 Subject: [PATCH] Fix Ingress (#70) Bump chart version to 2.0.7 Fix Ingress - Ingress uses now .Capabilities.APIVersions.Has to compare the api version available - Added pathType since it is required in v1 and optional in v1beta1 Co-authored-by: Lucas Hahn Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/70 Reviewed-by: Andrew Thornton Reviewed-by: Lunny Xiao Co-Authored-By: luhahn Co-Committed-By: luhahn --- Chart.yaml | 2 +- templates/gitea/ingress.yaml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index 9c2c807..0eef6a1 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: gitea description: Gitea Helm chart for Kubernetes type: application -version: 2.0.6 +version: 2.0.7 appVersion: 1.12.6 icon: https://docs.gitea.io/images/gitea.png diff --git a/templates/gitea/ingress.yaml b/templates/gitea/ingress.yaml index 297c3ea..d56455a 100644 --- a/templates/gitea/ingress.yaml +++ b/templates/gitea/ingress.yaml @@ -1,9 +1,9 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "gitea.fullname" . -}} {{- $httpPort := .Values.service.http.port -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} apiVersion: extensions/v1beta1 @@ -34,13 +34,14 @@ spec: http: paths: - path: / + pathType: Prefix backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1" }} service: name: {{ $fullName }}-http port: number: {{ $httpPort }} - {{- else -}} + {{- else }} serviceName: {{ $fullName }}-http servicePort: {{ $httpPort }} {{- end }}