Skip to content

Commit

Permalink
Merge pull request #2 from librepod/add-hajimari-chart
Browse files Browse the repository at this point in the history
Update ingress template
  • Loading branch information
cyxou authored May 6, 2022
2 parents df3444b + 59ce88a commit 7eb05f7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion charts/hajimari/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |
Hajimari is a beautiful & customizable browser startpage/dashboard with
Kubernetes application discovery
name: hajimari
version: 0.1.0
version: 0.1.1
kubeVersion: ">=1.16.0-0"
keywords:
- hajimari
Expand Down
64 changes: 43 additions & 21 deletions charts/hajimari/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := printf "%s-%s" (include "hajimari.fullname" .) "web" -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $fullName := include "hajimari.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- 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
{{- end }}
kind: Ingress
metadata:
name: {{ template "hajimari.fullname" . }}
name: {{ $fullName }}
labels:
app: {{ template "hajimari.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- include "hajimari.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
{{- if .Values.ingress.tls }}
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end }}
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
- path: {{ $ingressPath }}
pathType: ImplementationSpecific
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $serviceName }}
name: {{ $fullName }}
port:
name: http
{{- end }}
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 7eb05f7

Please sign in to comment.