Add ingress

This commit is contained in:
Jonny Ervine 2023-09-27 21:19:50 +08:00
parent 0c23dcb56f
commit f797416bec

View File

@ -1,24 +1,20 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "jellyfin.fullname" . -}}
{{- if .Values.ingress.external.enabled -}}
{{- $fullName := include "emby.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
name: {{ $fullName }}-ext
labels:
{{- include "jellyfin.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
{{- include "emby.labels" . | nindent 4 }}
{{- with .Values.ingress.external.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
{{- if .Values.ingress.external.tls }}
tls:
{{- range .Values.ingress.tls }}
{{- range .Values.ingress.external.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
@ -27,15 +23,59 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- range .Values.ingress.external.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
- path: /
pathType: Prefix
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
---
{{- if .Values.ingress.internal.enabled -}}
{{- $fullName := include "emby.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}-int
labels:
{{- include "emby.labels" . | nindent 4 }}
{{- with .Values.ingress.external.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.internal.tls }}
tls:
{{- range .Values.ingress.internal.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.internal.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}