Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Add ingress api version compatibility (#6)
Browse files Browse the repository at this point in the history
* Add ingress api version compatibility for extensions/v1beta1, networking.k8s.io/v1beta1, networking.k8s.io/v1

Bump Chart version

Signed-off-by: Dominic Gabriel <[email protected]>

* Update Chart.yaml to 0.1.8

Signed-off-by: Dominic Gabriel <[email protected]>
  • Loading branch information
DoGab authored Oct 3, 2022
1 parent 8117cfc commit 452c9e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
12 changes: 11 additions & 1 deletion templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

0 comments on commit 452c9e2

Please sign in to comment.