Sync HTPC Manifests to GitOps / Sync Manifests to GitOps Repo (push) Successful in 4s
176 lines
6.3 KiB
YAML
176 lines
6.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: jellyfin
|
|
namespace: htpc
|
|
labels:
|
|
app.kubernetes.io/name: jellyfin
|
|
app.kubernetes.io/part-of: htpc
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: jellyfin
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: jellyfin
|
|
app.kubernetes.io/name: jellyfin
|
|
app.kubernetes.io/part-of: htpc
|
|
spec:
|
|
nodeSelector:
|
|
kubernetes.io/hostname: vmserver
|
|
initContainers:
|
|
- name: migrate-config
|
|
image: lscr.io/linuxserver/jellyfin:latest
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- |
|
|
if [ ! -f /config/system.xml ] && [ -f /host-etc/system.xml ]; then
|
|
echo "Syncing Jellyfin configuration from /etc/jellyfin..."
|
|
cp -a /host-etc/* /config/
|
|
sed -i 's|<MetadataPath>/var/lib/jellyfin/metadata</MetadataPath>|<MetadataPath>/config/metadata</MetadataPath>|g' /config/system.xml || true
|
|
sed -i 's|<CachePath>/var/cache/jellyfin</CachePath>|<CachePath>/config/cache</CachePath>|g' /config/system.xml || true
|
|
fi
|
|
|
|
mkdir -p /config/data/data /config/data/root /config/data/plugins /config/metadata /config/cache /config/log
|
|
|
|
# Move misplaced database files into /config/data/data if needed
|
|
if [ -f /config/data/jellyfin.db ]; then
|
|
echo "Relocating database files from /config/data to /config/data/data..."
|
|
mv -n /config/data/*.db* /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/playlists /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/subtitles /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/ScheduledTasks /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/SQLiteBackups /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/attachments /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/device.txt /config/data/data/ 2>/dev/null || true
|
|
mv -n /config/data/splashscreen.png /config/data/data/ 2>/dev/null || true
|
|
fi
|
|
|
|
if [ ! -f /config/data/data/jellyfin.db ] && [ -d /host-data/data ]; then
|
|
echo "Syncing data from /var/lib/jellyfin/data..."
|
|
cp -a /host-data/data/* /config/data/data/ || true
|
|
fi
|
|
|
|
if [ ! -d /config/metadata/library ] && [ -d /host-data/metadata ]; then
|
|
echo "Syncing metadata from /var/lib/jellyfin/metadata..."
|
|
cp -a /host-data/metadata/* /config/metadata/ || true
|
|
fi
|
|
|
|
if [ ! -d /config/data/plugins/configurations ] && [ -d /host-data/plugins ]; then
|
|
echo "Syncing plugins from /var/lib/jellyfin/plugins..."
|
|
cp -a /host-data/plugins/* /config/data/plugins/ || true
|
|
fi
|
|
|
|
if [ ! -d /config/data/root/default ] && [ -d /host-data/root ]; then
|
|
echo "Syncing root library structure from /var/lib/jellyfin/root..."
|
|
cp -a /host-data/root/* /config/data/root/ || true
|
|
fi
|
|
|
|
[ ! -e /config/root ] && ln -sf /config/data/root /config/root || true
|
|
[ ! -e /config/plugins ] && ln -sf /config/data/plugins /config/plugins || true
|
|
|
|
# Legacy compatibility for historical paths pointing to /var/lib/jellyfin
|
|
mkdir -p /config/legacy-jellyfin
|
|
ln -sfn /config/data/root /config/legacy-jellyfin/root
|
|
ln -sfn /config/metadata /config/legacy-jellyfin/metadata
|
|
ln -sfn /config/data/data /config/legacy-jellyfin/data
|
|
chmod 755 /config/legacy-jellyfin
|
|
chown -R 33:33 /config/legacy-jellyfin
|
|
|
|
chown -R 33:33 /config
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /config
|
|
- name: host-etc
|
|
mountPath: /host-etc
|
|
readOnly: true
|
|
- name: host-data
|
|
mountPath: /host-data
|
|
readOnly: true
|
|
containers:
|
|
- name: jellyfin
|
|
image: lscr.io/linuxserver/jellyfin:latest
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
privileged: true
|
|
env:
|
|
- name: PUID
|
|
value: "33"
|
|
- name: PGID
|
|
value: "33"
|
|
- name: TZ
|
|
value: "Europe/Amsterdam"
|
|
- name: DOTNET_gcServer
|
|
value: "0"
|
|
- name: DOTNET_GCHeapHardLimit
|
|
value: "0x160000000"
|
|
- name: DOTNET_GCLargeObjectHeapCompactionMode
|
|
value: "1"
|
|
ports:
|
|
- name: http
|
|
containerPort: 8096
|
|
hostPort: 8096
|
|
resources:
|
|
requests:
|
|
cpu: 200m
|
|
memory: 1Gi
|
|
limits:
|
|
cpu: 4000m
|
|
memory: 8Gi
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /config
|
|
- name: datadisk
|
|
mountPath: /datadisk
|
|
- name: mnt-mp3
|
|
mountPath: /mnt/mp3
|
|
- name: dri
|
|
mountPath: /dev/dri
|
|
- name: config
|
|
mountPath: /var/lib/jellyfin
|
|
subPath: legacy-jellyfin
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /jellyfin/health
|
|
port: 8096
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 20
|
|
timeoutSeconds: 5
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /jellyfin/health
|
|
port: 8096
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
volumes:
|
|
- name: config
|
|
persistentVolumeClaim:
|
|
claimName: jellyfin-config
|
|
- name: datadisk
|
|
hostPath:
|
|
path: /datadisk
|
|
type: Directory
|
|
- name: mnt-mp3
|
|
hostPath:
|
|
path: /mnt/mp3
|
|
type: Directory
|
|
- name: dri
|
|
hostPath:
|
|
path: /dev/dri
|
|
type: Directory
|
|
- name: host-etc
|
|
hostPath:
|
|
path: /etc/jellyfin
|
|
type: DirectoryOrCreate
|
|
- name: host-data
|
|
hostPath:
|
|
path: /var/lib/jellyfin
|
|
type: DirectoryOrCreate
|