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