Skip to content

Commit fef6352

Browse files
committed
Add support for existing PVCs and read-only configurations
Introduce `existingClaim` and `readOnly` fields for PVCs to allow using pre-existing claims and enforcing read-only mounts. Update Deployment and PVC templates to handle these new configurations, providing greater flexibility in volume management.
1 parent f36e87a commit fef6352

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

charts/shoebox/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: shoebox
33
description: A Helm chart for the Shoebox application - a digital shoebox for your videos
44
type: application
5-
version: 0.0.11
5+
version: 0.0.12
66
appVersion: "main"
77
keywords:
88
- video

charts/shoebox/templates/deployment.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,39 +66,56 @@ spec:
6666
{{- if and .Values.persistence.data.enabled (not .Values.postgresql.enabled) }}
6767
- name: data
6868
mountPath: /app/data
69+
{{- if .Values.persistence.data.readOnly }}
70+
readOnly: true
71+
{{- end }}
6972
{{- end }}
7073
{{- if .Values.persistence.thumbnails.enabled }}
7174
- name: thumbnails
7275
mountPath: /app/thumbnails
76+
{{- if .Values.persistence.thumbnails.readOnly }}
77+
readOnly: true
78+
{{- end }}
7379
{{- end }}
7480
{{- if .Values.persistence.exports.enabled }}
7581
- name: exports
7682
mountPath: /app/exports
83+
{{- if .Values.persistence.exports.readOnly }}
84+
readOnly: true
85+
{{- end }}
7786
{{- end }}
7887
{{- if .Values.persistence.media.enabled }}
7988
{{- if kindIs "string" .Values.config.mediaSourcePaths }}
8089
- name: media
8190
mountPath: /mnt/videos
91+
{{- if .Values.persistence.media.readOnly }}
8292
readOnly: true
93+
{{- end }}
8394
{{- else }}
8495
{{- range .Values.config.mediaSourcePaths.sources }}
8596
- name: media-{{ .name | lower }}
8697
mountPath: {{ .path }}
98+
{{- if $.Values.persistence.media.readOnly }}
8799
readOnly: true
100+
{{- end }}
88101
{{- end }}
89102
{{- end }}
90103
{{- end }}
91104
{{- if .Values.persistence.media.enabled }}
92105
{{- if kindIs "string" .Values.config.mediaSourcePaths }}
93106
- name: original-media
94107
mountPath: /home/user/videos
108+
{{- if .Values.persistence.media.readOnly }}
95109
readOnly: true
110+
{{- end }}
96111
{{- else }}
97112
{{- range .Values.config.mediaSourcePaths.sources }}
98113
{{- if .originalPath }}
99114
- name: original-media-{{ .name | lower }}
100115
mountPath: {{ .originalPath }}
116+
{{- if $.Values.persistence.media.readOnly }}
101117
readOnly: true
118+
{{- end }}
102119
{{- end }}
103120
{{- end }}
104121
{{- end }}
@@ -119,12 +136,20 @@ spec:
119136
{{- if and .Values.persistence.data.enabled (not .Values.postgresql.enabled) }}
120137
- name: data
121138
persistentVolumeClaim:
139+
{{- if .Values.persistence.data.existingClaim }}
140+
claimName: {{ .Values.persistence.data.existingClaim }}
141+
{{- else }}
122142
claimName: {{ include "shoebox.fullname" . }}-data
143+
{{- end }}
123144
{{- end }}
124145
{{- if .Values.persistence.thumbnails.enabled }}
125146
- name: thumbnails
126147
persistentVolumeClaim:
148+
{{- if .Values.persistence.thumbnails.existingClaim }}
149+
claimName: {{ .Values.persistence.thumbnails.existingClaim }}
150+
{{- else }}
127151
claimName: {{ include "shoebox.fullname" . }}-thumbnails
152+
{{- end }}
128153
{{- end }}
129154
{{- if .Values.persistence.exports.enabled }}
130155
- name: exports

charts/shoebox/templates/pvc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.persistence.data.enabled (not .Values.postgresql.enabled) }}
1+
{{- if and .Values.persistence.data.enabled (not .Values.postgresql.enabled) (not .Values.persistence.data.existingClaim) }}
22
apiVersion: v1
33
kind: PersistentVolumeClaim
44
metadata:
@@ -16,7 +16,7 @@ spec:
1616
{{- end }}
1717
---
1818
{{- end }}
19-
{{- if .Values.persistence.thumbnails.enabled }}
19+
{{- if and .Values.persistence.thumbnails.enabled (not .Values.persistence.thumbnails.existingClaim) }}
2020
apiVersion: v1
2121
kind: PersistentVolumeClaim
2222
metadata:

charts/shoebox/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,33 @@ persistence:
119119
size: 1Gi
120120
storageClass: ""
121121
accessMode: ReadWriteOnce
122+
existingClaim: ""
123+
readOnly: false
122124

123125
# Thumbnails directory
124126
thumbnails:
125127
enabled: true
126128
size: 5Gi
127129
storageClass: ""
128130
accessMode: ReadWriteOnce
131+
existingClaim: ""
132+
readOnly: false
129133

130134
# Exports directory
131135
exports:
132136
enabled: true
133137
size: 10Gi
134138
storageClass: ""
135139
accessMode: ReadWriteOnce
140+
existingClaim: ""
141+
readOnly: false
136142

137143
# Media source directory (read-only)
138144
media:
139145
enabled: true
140146
# This should be a PV that points to your media storage
141147
existingClaim: ""
148+
readOnly: true
142149
# If no existing claim, create a PVC with these settings
143150
size: 100Gi
144151
storageClass: ""

0 commit comments

Comments
 (0)