Skip to content

Commit

Permalink
feat(helm): add support for Kubernetes Ingress v1 (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
chgl committed Aug 9, 2021
1 parent 79d0f96 commit ff07a3d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion helm/akhq/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.18.0"
description: Kafka GUI for Apache Kafka to manage topics, topics data, consumers group, schema registry, connect and more...
name: akhq
version: 0.2.3
version: 0.2.4
keywords:
- kafka
- confluent
Expand Down
13 changes: 13 additions & 0 deletions helm/akhq/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 "akhq.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for Ingress
*/}}
{{- define "akhq.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.Version -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.Version -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
12 changes: 11 additions & 1 deletion helm/akhq/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "akhq.fullname" . -}}
{{- $ingressPaths := .Values.ingress.paths -}}
apiVersion: networking.k8s.io/v1beta1
apiVersion: {{ include "akhq.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand Down Expand Up @@ -32,9 +32,19 @@ spec:
paths:
{{- range $ingressPaths }}
- path: {{ . }}
{{- if eq (include "akhq.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: "ImplementationSpecific"
{{- end }}
backend:
{{- if eq (include "akhq.ingress.apiVersion" $) "networking.k8s.io/v1" }}
service:
name: {{ $fullName }}
port:
name: http
{{ else }}
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit ff07a3d

Please sign in to comment.