Files

71 lines
2.1 KiB
YAML

apiVersion: batch/v1
kind: Job
metadata:
name: jellyfin-cold-backup-pre-12-2
namespace: jellyfin
labels:
app.kubernetes.io/name: jellyfin
app.kubernetes.io/component: backup
spec:
backoffLimit: 0
template:
metadata:
labels:
app.kubernetes.io/name: jellyfin
app.kubernetes.io/component: backup
spec:
restartPolicy: Never
automountServiceAccountToken: false
nodeSelector:
kubernetes.io/hostname: arschrock
media.brunner.ninja/multimedia-ready: "true"
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: backup
image: docker.io/library/alpine:3.24.2
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -ec
- |
archive=/backup/jellyfin-pvc-pre-12.2.tar
test "$(stat -f -c '%t' /backup)" = ca451a4e
if [ ! -f "${archive}" ]; then
tar -C /state -cpf "${archive}.partial" .
mv "${archive}.partial" "${archive}"
fi
tar -tf "${archive}" >/dev/null
sha256sum "${archive}" >"${archive}.sha256"
find /state -xdev -type f | wc -l >"${archive}.source-file-count"
du -sb /state >"${archive}.source-bytes"
ls -lh "${archive}" "${archive}.sha256"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
add:
- DAC_READ_SEARCH
readOnlyRootFilesystem: true
volumeMounts:
- name: state
mountPath: /state
readOnly: true
- name: backup
mountPath: /backup
volumes:
- name: state
persistentVolumeClaim:
claimName: jellyfin-config
readOnly: true
- name: backup
hostPath:
path: /komposthaufen/backups/jellyfin
type: DirectoryOrCreate