diff --git a/Chart.yaml b/Chart.yaml index 6375728..9ec45c9 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: adminer appVersion: 4.8.1 -version: 0.1.7 +version: 0.1.8 description: Adminer is a full-featured database management tool written in PHP. Conversely to phpMyAdmin, it consist of a single file ready to deploy to the target server. Adminer is available for MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, Firebird, SimpleDB, Elasticsearch and MongoDB home: https://www.adminer.org icon: https://raw.githubusercontent.com/Kong/docker-official-docs/master/adminer/logo.png diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index d223408..c839aa7 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -30,3 +30,16 @@ Create chart name and version as used by the chart label. {{- define "adminer.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Evaluate the correct ingress apiVersion according to the kubernetes version +*/}} +{{- define "adminer.ingress.apiVersion" -}} +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/templates/ingress.yaml b/templates/ingress.yaml index b5cb16f..abbcadc 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -2,7 +2,7 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "adminer.fullname" . -}} {{- $ingressPath := .Values.ingress.path -}} -apiVersion: extensions/v1beta1 +apiVersion: {{ include "adminer.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ template "adminer.fullname" . }}-ingress @@ -33,8 +33,18 @@ spec: http: paths: - path: {{ $ingressPath }} + {{- if eq (include "adminer.ingress.apiVersion" $) "networking.k8s.io/v1" }} + pathType: Prefix + {{- end }} backend: + {{- if eq (include "adminer.ingress.apiVersion" $) "networking.k8s.io/v1" }} + service: + name: {{ $fullName }} + port: + name: http + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }}