feat(persistence): add cache volume persistence support

Add dedicated cache volume configuration to reduce wear on SD cards and improve
performance by allowing cache to be stored on separate storage.

Changes:
- Add persistence.cache configuration in values.yaml with support for:
  - PVC (default type when enabled)
  - hostPath for direct host mount
  - emptyDir (default when disabled)
- Add cache volume mount at /cache in deployment
- Add cache PersistentVolumeClaim template
- Support for existing PVC via existingClaim
- Configurable size (default 10Gi), accessMode, storageClass, and annotations
- Update Chart version from 2.5.0 to 2.5.1
- Add Artifact Hub changelog annotation

The cache volume is disabled by default to maintain backward compatibility.
Users can enable it via:

```yaml
persistence:
  cache:
    enabled: true
    type: pvc
    size: 10Gi
```

This addresses the use case mentioned in #62 where users want to avoid SD card
wear by storing cache on separate persistent storage.

Fixes: #62

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei SviridkinandClaude committed 2025-11-05 23:26:58 +03:00 Unverified
1 parent 2401a45bb1
commit 35f39bf92c
5 files changed
+69 -2

No files matched your search

+17
View File
@@ -119,6 +119,8 @@ spec:
name: config
- mountPath: /media
name: media
- mountPath: /cache
name: cache
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
@@ -152,6 +154,21 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
- name: cache
{{- if .Values.persistence.cache.enabled }}
{{- if eq .Values.persistence.cache.type "pvc" }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.cache.existingClaim }}{{ .Values.persistence.cache.existingClaim }}{{- else }}{{ template "jellyfin.fullname" . }}-cache{{- end }}
{{- else if eq .Values.persistence.cache.type "hostPath" }}
hostPath:
path: {{ .Values.persistence.cache.hostPath }}
type: Directory
{{- else }}
emptyDir: {}
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -43,3 +43,26 @@ spec:
storageClassName: {{ . | quote }}
{{- end }}
{{- end }}
{{- if and .Values.persistence.cache.enabled (eq .Values.persistence.cache.type "pvc") (not .Values.persistence.cache.existingClaim) }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "jellyfin.fullname" . }}-cache
labels:
{{- include "jellyfin.labels" . | nindent 4 }}
{{- with .Values.persistence.cache.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.cache.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.cache.size | quote }}
{{- with .Values.persistence.cache.storageClass }}
storageClassName: {{ . | quote }}
{{- end }}
{{- end }}