Skip to content

Commit 24c71a2

Browse files
committed
Add PVC support for original media in Shoebox chart
Introduced support for creating and managing PersistentVolumeClaims (PVCs) for original media storage based on media source paths. This includes configurable options for existing claims or dynamically created PVCs and ensures proper mounting in deployments. Enhancements improve flexibility in handling original media storage configurations.
1 parent 140f622 commit 24c71a2

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

charts/shoebox/templates/deployment.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ spec:
8888
{{- end }}
8989
{{- end }}
9090
{{- end }}
91+
{{- if .Values.persistence.originalMedia.enabled }}
92+
{{- if kindIs "string" .Values.config.mediaSourcePaths }}
93+
- name: original-media
94+
mountPath: /home/user/videos
95+
readOnly: true
96+
{{- else }}
97+
{{- range .Values.config.mediaSourcePaths.sources }}
98+
{{- if .originalPath }}
99+
- name: original-media-{{ .name | lower }}
100+
mountPath: {{ .originalPath }}
101+
readOnly: true
102+
{{- end }}
103+
{{- end }}
104+
{{- end }}
105+
{{- end }}
91106
{{- with .Values.nodeSelector }}
92107
nodeSelector:
93108
{{- toYaml . | nindent 8 }}
@@ -141,3 +156,28 @@ spec:
141156
{{- end }}
142157
{{- end }}
143158
{{- end }}
159+
{{- if .Values.persistence.originalMedia.enabled }}
160+
{{- if kindIs "string" .Values.config.mediaSourcePaths }}
161+
- name: original-media
162+
persistentVolumeClaim:
163+
{{- if .Values.persistence.originalMedia.existingClaim }}
164+
claimName: {{ .Values.persistence.originalMedia.existingClaim }}
165+
{{- else }}
166+
claimName: {{ include "shoebox.fullname" . }}-original-media
167+
{{- end }}
168+
{{- else }}
169+
{{- range .Values.config.mediaSourcePaths.sources }}
170+
{{- if .originalPath }}
171+
- name: original-media-{{ .name | lower }}
172+
persistentVolumeClaim:
173+
{{- if .originalExistingClaim }}
174+
claimName: {{ .originalExistingClaim }}
175+
{{- else if $.Values.persistence.originalMedia.existingClaim }}
176+
claimName: {{ $.Values.persistence.originalMedia.existingClaim }}-{{ .name | lower }}
177+
{{- else }}
178+
claimName: {{ include "shoebox.fullname" $ }}-original-media-{{ .name | lower }}
179+
{{- end }}
180+
{{- end }}
181+
{{- end }}
182+
{{- end }}
183+
{{- end }}

charts/shoebox/templates/pvc.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,45 @@ spec:
9090
{{- end }}
9191
{{- end }}
9292
{{- end }}
93+
94+
{{- if and .Values.persistence.originalMedia.enabled (not .Values.persistence.originalMedia.existingClaim) }}
95+
{{- if kindIs "string" .Values.config.mediaSourcePaths }}
96+
---
97+
apiVersion: v1
98+
kind: PersistentVolumeClaim
99+
metadata:
100+
name: {{ include "shoebox.fullname" . }}-original-media
101+
labels:
102+
{{- include "shoebox.labels" . | nindent 4 }}
103+
spec:
104+
accessModes:
105+
- {{ .Values.persistence.originalMedia.accessMode }}
106+
resources:
107+
requests:
108+
storage: {{ .Values.persistence.originalMedia.size }}
109+
{{- if .Values.persistence.originalMedia.storageClass }}
110+
storageClassName: {{ .Values.persistence.originalMedia.storageClass }}
111+
{{- end }}
112+
{{- else }}
113+
{{- range .Values.config.mediaSourcePaths.sources }}
114+
{{- if and .originalPath (not .originalExistingClaim) }}
115+
---
116+
apiVersion: v1
117+
kind: PersistentVolumeClaim
118+
metadata:
119+
name: {{ include "shoebox.fullname" $ }}-original-media-{{ .name | lower }}
120+
labels:
121+
{{- include "shoebox.labels" $ | nindent 4 }}
122+
spec:
123+
accessModes:
124+
- {{ $.Values.persistence.originalMedia.accessMode }}
125+
resources:
126+
requests:
127+
storage: {{ $.Values.persistence.originalMedia.size }}
128+
{{- if $.Values.persistence.originalMedia.storageClass }}
129+
storageClassName: {{ $.Values.persistence.originalMedia.storageClass }}
130+
{{- end }}
131+
{{- end }}
132+
{{- end }}
133+
{{- end }}
134+
{{- end }}

charts/shoebox/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ config:
100100
path: /mnt/videos
101101
originalPath: /home/user/videos
102102
originalExtension: mp4
103+
# Optional: specify an existing claim for this source's originalPath
104+
# originalExistingClaim: "existing-claim-name"
103105
- name: gopro
104106
path: /mnt/other-videos
105107
originalPath: /media/external/videos
108+
# Optional: specify an existing claim for this source's originalPath
109+
# originalExistingClaim: "existing-claim-name"
106110
thumbnailPath: "/app/thumbnails"
107111
exportBasePath: "/app/exports"
108112
rustLog: "info"
@@ -140,6 +144,17 @@ persistence:
140144
storageClass: ""
141145
accessMode: ReadOnlyMany
142146

147+
# Original media source directory (read-only)
148+
# This is used for the originalPath in mediaSourcePaths
149+
originalMedia:
150+
enabled: true
151+
# This should be a PV that points to your original media storage
152+
existingClaim: ""
153+
# If no existing claim, create a PVC with these settings
154+
size: 100Gi
155+
storageClass: ""
156+
accessMode: ReadOnlyMany
157+
143158
# Optional PostgreSQL dependency
144159
postgresql:
145160
enabled: false

0 commit comments

Comments
 (0)