diff --git a/charts/stable/jellyfin/Chart.yaml b/charts/stable/jellyfin/Chart.yaml index 74fc6b7119b..9b09c182196 100644 --- a/charts/stable/jellyfin/Chart.yaml +++ b/charts/stable/jellyfin/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/jellyfin - https://github.com/jellyfin/jellyfin type: application -version: 14.0.22 +version: 14.1.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/stable/jellyfin/questions.yaml b/charts/stable/jellyfin/questions.yaml index a37d12be157..2dfd82ca2bb 100644 --- a/charts/stable/jellyfin/questions.yaml +++ b/charts/stable/jellyfin/questions.yaml @@ -12,19 +12,18 @@ questions: # Include{containerMain} - - variable: env + - variable: autodiscovery group: "App Configuration" - label: "Image Environment" + label: "Autodiscovery" schema: additional_attrs: true type: dict attrs: - - variable: JELLYFIN_PublishedServerUrl - description: "Published Server URL" - label: "The Server URL to publish in UDP Auto Discovery response." - schema: - type: string - default: "" + - variable: enabled + label: "Enable Autodiscovery on LAN" + schema: + type: boolean + default: false # Include{containerBasic} # Include{containerAdvanced} diff --git a/charts/stable/jellyfin/templates/common.yaml b/charts/stable/jellyfin/templates/common.yaml index b51394e00a4..754fc728167 100644 --- a/charts/stable/jellyfin/templates/common.yaml +++ b/charts/stable/jellyfin/templates/common.yaml @@ -1 +1,8 @@ -{{ include "tc.v1.common.loader.all" . }} +{{- include "tc.v1.common.loader.init" . }} + +{{- if .Values.autodiscovery.enabled -}} +{{/* Add proxy workload */}} +{{- $_ := set .Values.workload.broadcastproxy "enabled" true -}} +{{- end -}} + +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/jellyfin/values.yaml b/charts/stable/jellyfin/values.yaml index adf13c69753..cbda7dd263a 100644 --- a/charts/stable/jellyfin/values.yaml +++ b/charts/stable/jellyfin/values.yaml @@ -2,12 +2,24 @@ image: repository: tccr.io/truecharts/jellyfin pullPolicy: IfNotPresent tag: v10.8.10@sha256:d2c377ee7ea463110a1dda7eb1b231424ad05245aaf95744e76164bd2e593377 +broadcastProxyImage: + repository: tccr.io/truecharts/socat + pullPolicy: IfNotPresent + tag: v1.7.4.4 service: main: ports: main: port: 8096 targetPort: 8096 + autodiscovery: + enabled: true + ports: + autodiscovery: + enabled: true + protocol: udp + port: 7359 + targetPort: 7359 persistence: config: enabled: true @@ -32,4 +44,53 @@ workload: containers: main: env: - JELLYFIN_PublishedServerUrl: "https://jelly.mydomain.com" + JELLYFIN_PublishedServerUrl: "{{ $.Values.chartContext.APPURL }}" + broadcastproxy: + enabled: false + type: DaemonSet + podSpec: + hostNetwork: true + # Proxy doesn't seem to respect the TERM signal, so by default + # this ends up just hanging until the default grace period ends. + # This is unnecesary since this workload only proxies autodiscovery + # messages. + terminationGracePeriodSeconds: 3 + containers: + broadcastproxy: + enabled: true + primary: true + imageSelector: broadcastProxyImage + securityContext: + readOnlyRootFilesystem: true + command: ["/bin/sh"] + # Quite a lot going on here: + # - Resolve Jellyfin's autodiscovery service IP from its FQDN via getent hosts + # - Export the IP to `$TARGET_IP` + # - Check `$TARGET_IP` is not empty (so we can crash if it is - will help to detect templating errors) + # - Touch `/tmp/healty` to use with the readiness, liveness and startup probes + # - Start socat in proxy mode + # - On exit remove `/tmp/healthy` + args: ["-c", "export TARGET_IP=$(getent hosts '{{ printf \"%v-autodiscovery\" (include \"tc.v1.common.lib.chart.names.fullname\" $) }}' | awk '{ print $1 }') && [[ ! -z $TARGET_IP ]] && touch /tmp/healthy && socat UDP-LISTEN:7359,fork,reuseaddr,rcvbuf=8096 UDP4-SENDTO:${TARGET_IP}:7359,rcvbuf=8096 ; rm -rf /tmp/healthy"] + probes: + readiness: + enabled: true + type: exec + command: + - cat + - /tmp/healthy + liveness: + enabled: true + type: exec + command: + - cat + - /tmp/healthy + startup: + enabled: true + type: exec + command: + - cat + - /tmp/healthy + +# -- enable Jellyfin autodiscovery on LAN +autodiscovery: + enabled: false