From d753b5ffc3a6bcfe8751c78ca60e3a7eb5f8c640 Mon Sep 17 00:00:00 2001 From: Brock Allen Date: Sat, 25 Jan 2025 01:47:59 -0800 Subject: [PATCH] feat(emby): Enable autodiscovery (#30924) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [x] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning - [x] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):` or `chore(chart-name):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Brocklobsta Signed-off-by: Alfred Göppel <43101280+alfi0812@users.noreply.github.com> Co-authored-by: Alfred Göppel <43101280+alfi0812@users.noreply.github.com> --- charts/stable/emby/Chart.yaml | 3 +- charts/stable/emby/values.yaml | 62 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/charts/stable/emby/Chart.yaml b/charts/stable/emby/Chart.yaml index 40a1c3fe7f8..8030e04df5b 100644 --- a/charts/stable/emby/Chart.yaml +++ b/charts/stable/emby/Chart.yaml @@ -33,5 +33,6 @@ sources: - https://ghcr.io/elfhosted/emby - https://github.com/linuxserver/docker-emby.git - https://github.com/truecharts/charts/tree/master/charts/stable/emby + - https://hub.docker.com/r/alpine/socat type: application -version: 22.2.2 +version: 22.4.0 diff --git a/charts/stable/emby/values.yaml b/charts/stable/emby/values.yaml index f108cebf929..8b4b0ef32fa 100644 --- a/charts/stable/emby/values.yaml +++ b/charts/stable/emby/values.yaml @@ -2,6 +2,10 @@ image: repository: ghcr.io/elfhosted/emby pullPolicy: IfNotPresent tag: 4.9.0.37@sha256:f2993275af1b96127cfcb10f2e87403cd35645263730785cd5f372c0f768aa38 +broadcastProxyImage: + repository: docker.io/alpine/socat + pullPolicy: IfNotPresent + tag: 1.8.0.0@sha256:a6be4c0262b339c53ddad723cdd178a1a13271e1137c65e27f90a08c16de02b8 securityContext: container: readOnlyRootFilesystem: false @@ -11,6 +15,14 @@ service: main: port: 10079 targetPort: 8096 + autodiscovery: + enabled: "{{ .Values.autodiscovery.enabled }}" + ports: + autodiscovery: + enabled: true + protocol: udp + port: 7359 + targetPort: 7359 workload: main: podSpec: @@ -27,6 +39,56 @@ workload: type: http path: / env: {} + broadcastproxy: + enabled: "{{ .Values.autodiscovery.enabled }}" + type: Deployment + 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 Emby'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 -T1 UDP4-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 Emby autodiscovery on LAN +autodiscovery: + enabled: false persistence: config: enabled: true