Add Helm chart for the media stack
Jellyfin (QuickSync), Sonarr, Radarr, Prowlarr, SABnzbd, Bazarr, Seerr and FlareSolverr in the media namespace. Shared hostPath /srv/media mounted at /data in every pod so imports are hardlinked; per-app config on local-path PVCs; LAN-only ingress via letsencrypt-dns-cloudflare. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
{{- $root := . }}
|
||||
{{- range $name, $app := .Values.apps }}
|
||||
{{- if $app.enabled }}
|
||||
{{- $linuxserver := ne (toString $app.linuxserver) "false" }}
|
||||
{{- if $app.configPath }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ $name }}-config
|
||||
namespace: {{ $root.Values.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
{{- include "media.labels" $root | nindent 4 }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
{{- if $root.Values.storageClassName }}
|
||||
storageClassName: {{ $root.Values.storageClassName }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ $app.configSize | default "1Gi" }}
|
||||
---
|
||||
{{- end }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
namespace: {{ $root.Values.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
{{- include "media.labels" $root | nindent 4 }}
|
||||
spec:
|
||||
replicas: 1
|
||||
# RWO volumes + SQLite databases: never run two instances at once.
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
{{- include "media.labels" $root | nindent 8 }}
|
||||
spec:
|
||||
{{- if or $app.media $app.sabnzbdHostWhitelist }}
|
||||
initContainers:
|
||||
{{- if $app.media }}
|
||||
- name: media-dirs
|
||||
image: {{ $root.Values.initImage }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |
|
||||
chown {{ $root.Values.common.puid }}:{{ $root.Values.common.pgid }} {{ $root.Values.media.mountPath }}
|
||||
{{- range $root.Values.media.dirs }}
|
||||
mkdir -p {{ $root.Values.media.mountPath }}/{{ . }}
|
||||
chown {{ $root.Values.common.puid }}:{{ $root.Values.common.pgid }} {{ $root.Values.media.mountPath }}/{{ . }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: media
|
||||
mountPath: {{ $root.Values.media.mountPath }}
|
||||
{{- end }}
|
||||
{{- if $app.sabnzbdHostWhitelist }}
|
||||
- name: sabnzbd-host-whitelist
|
||||
image: {{ $root.Values.initImage }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |
|
||||
f={{ $app.configPath }}/sabnzbd.ini
|
||||
hosts="{{ include "media.sabnzbdHosts" $root }}"
|
||||
if [ ! -f "$f" ]; then
|
||||
printf '[misc]\nhost_whitelist = %s\n' "$hosts" > "$f"
|
||||
chown {{ $root.Values.common.puid }}:{{ $root.Values.common.pgid }} "$f"
|
||||
echo "seeded $f"
|
||||
elif ! grep -q "^host_whitelist = $hosts\$" "$f"; then
|
||||
sed -i "s/^host_whitelist = .*/host_whitelist = $hosts/" "$f"
|
||||
echo "updated host_whitelist in $f"
|
||||
fi
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: {{ $app.configPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ $name }}
|
||||
image: {{ $app.image }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
{{- if $app.gpu }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ $app.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TZ
|
||||
value: {{ $root.Values.common.tz | quote }}
|
||||
{{- if $linuxserver }}
|
||||
- name: PUID
|
||||
value: {{ $root.Values.common.puid | quote }}
|
||||
- name: PGID
|
||||
value: {{ $root.Values.common.pgid | quote }}
|
||||
{{- end }}
|
||||
{{- range $app.env }}
|
||||
- name: {{ .name }}
|
||||
value: {{ .value | quote }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
failureThreshold: 5
|
||||
volumeMounts:
|
||||
{{- if $app.configPath }}
|
||||
- name: config
|
||||
mountPath: {{ $app.configPath }}
|
||||
{{- end }}
|
||||
{{- if $app.media }}
|
||||
- name: media
|
||||
mountPath: {{ $root.Values.media.mountPath }}
|
||||
{{- end }}
|
||||
{{- if $app.gpu }}
|
||||
- name: dri
|
||||
mountPath: /dev/dri
|
||||
{{- end }}
|
||||
{{- with $app.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or $app.configPath $app.media $app.gpu }}
|
||||
volumes:
|
||||
{{- if $app.configPath }}
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $name }}-config
|
||||
{{- end }}
|
||||
{{- if $app.media }}
|
||||
- name: media
|
||||
hostPath:
|
||||
path: {{ $root.Values.media.hostPath }}
|
||||
type: DirectoryOrCreate
|
||||
{{- end }}
|
||||
{{- if $app.gpu }}
|
||||
- name: dri
|
||||
hostPath:
|
||||
path: /dev/dri
|
||||
type: Directory
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
namespace: {{ $root.Values.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
{{- include "media.labels" $root | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ $app.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
{{- if $app.ingress }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
namespace: {{ $root.Values.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ $name }}
|
||||
{{- include "media.labels" $root | nindent 4 }}
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: {{ $root.Values.ingress.clusterIssuer }}
|
||||
{{- with $root.Values.ingress.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $app.ingressAnnotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ $root.Values.ingress.className }}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ $name }}.{{ $root.Values.ingress.domain }}
|
||||
secretName: {{ $name }}-tls
|
||||
rules:
|
||||
- host: {{ $name }}.{{ $root.Values.ingress.domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $name }}
|
||||
port:
|
||||
name: http
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user