Skip to content

Commit dbfee76

Browse files
committed
Add volumes for index and storage
1 parent 8003595 commit dbfee76

File tree

5 files changed

+122
-4
lines changed

5 files changed

+122
-4
lines changed

charts/orthanc/.helmignore

+3
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@
2121
.idea/
2222
*.tmproj
2323
.vscode/
24+
25+
# helm-unittest
26+
/tests

charts/orthanc/templates/deployment.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ spec:
147147
- name: config
148148
readOnly: true
149149
mountPath: /etc/orthanc
150+
{{- if .Values.persistence.storage.enabled }}
151+
- name: index
152+
mountPath: {{ .Values.config.IndexDirectory }}
153+
{{- end }}
154+
{{- if .Values.persistence.storage.enabled }}
155+
- name: storage
156+
mountPath: {{ .Values.config.StorageDirectory }}
157+
{{- end }}
150158
- name: tmp
151159
mountPath: {{ .Values.config.TemporaryDirectory }}
152160
{{- with include "orthanc.encryption-secret" . }}
@@ -161,6 +169,16 @@ spec:
161169
- name: config
162170
configMap:
163171
name: {{ include "orthanc.fullname" . }}
172+
{{- if .Values.persistence.storage.enabled }}
173+
- name: storage
174+
persistentVolumeClaim:
175+
claimName: {{ .Values.persistence.storage.existingClaim | default (include "orthanc.fullname" . | printf "%s-storage") }}
176+
{{- end }}
177+
{{- if .Values.persistence.index.enabled }}
178+
- name: index
179+
persistentVolumeClaim:
180+
claimName: {{ .Values.persistence.index.existingClaim | default (include "orthanc.fullname" . | printf "%s-index") }}
181+
{{- end }}
164182
- name: tmp
165183
emptyDir:
166184
{{- with .Values.emptyDirs.temporaryDirectory }}

charts/orthanc/templates/storage.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- define "orthanc.volume" }}
2+
{{- $volume := get .Values.persistence .name }}
3+
{{- if (and $volume.enabled (empty $volume.existingClaim)) }}
4+
apiVersion: v1
5+
kind: PersistentVolumeClaim
6+
metadata:
7+
name: {{ include "orthanc.fullname" . }}-{{ .name }}
8+
namespace: {{ .Release.Namespace }}
9+
labels:
10+
{{- merge $volume.labels (include "orthanc.labels" . | fromYaml) | toYaml | nindent 4 }}
11+
{{- with (merge $volume.annotations .Values.commonAnnotations) }}
12+
annotations:
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
spec:
16+
{{- with $volume.storageClass | default .Values.global.defaultStorageClass }}
17+
storageClassName: {{ . }}
18+
{{- end }}
19+
accessModes:
20+
{{- toYaml $volume.accessModes | nindent 4 }}
21+
resources:
22+
requests:
23+
storage: {{ $volume.size }}
24+
{{- end }}
25+
{{- end }}
26+
27+
{{- include "orthanc.volume" (merge (dict "name" "index") $) }}
28+
---
29+
{{- include "orthanc.volume" (merge (dict "name" "storage") $) }}
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
suite: PersistentVolumeClaims
2+
release:
3+
name: pvctest
4+
templates:
5+
- storage.yml
6+
tests:
7+
- it: should be empty when persistence is disabled
8+
set:
9+
persistence.index.enabled: false
10+
persistence.storage.enabled: false
11+
asserts:
12+
- hasDocuments:
13+
count: 0
14+
- it: should create a volume when existingClaim is empty
15+
set:
16+
persistence:
17+
index:
18+
enabled: true
19+
existingClaim: ""
20+
size: 2Gi
21+
storage:
22+
enabled: true
23+
existingClaim: "existing-claim-name"
24+
asserts:
25+
- hasDocuments:
26+
count: 1
27+
- containsDocument:
28+
apiVersion: v1
29+
kind: PersistentVolumeClaim
30+
name: pvctest-orthanc-index
31+
- equal:
32+
path: spec.resources.requests.storage
33+
value: 2Gi
34+
- it: should create both volumes
35+
set:
36+
persistence:
37+
index:
38+
enabled: true
39+
existingClaim: ""
40+
storage:
41+
enabled: true
42+
existingClaim: ""
43+
asserts:
44+
- hasDocuments:
45+
count: 2
46+
- containsDocument:
47+
apiVersion: v1
48+
kind: PersistentVolumeClaim
49+
name: pvctest-orthanc-index
50+
any: true
51+
- containsDocument:
52+
apiVersion: v1
53+
kind: PersistentVolumeClaim
54+
name: pvctest-orthanc-storage
55+
any: true
56+

charts/orthanc/values.yaml

+16-4
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ persistence:
191191
# -- PVC Storage Request for Orthanc SQLite index
192192
size: 1Gi
193193
# -- Annotations for the PVC
194-
annotations:
194+
annotations: {}
195195
# -- Labels for the PVC
196-
labels:
196+
labels: {}
197197
storage:
198198
# -- Enable Orthanc storage data persistence using PVC
199199
enabled: false
@@ -206,9 +206,9 @@ persistence:
206206
# -- PVC Storage Request for Orthanc storage
207207
size: 1Gi
208208
# -- Annotations for the PVC
209-
annotations:
209+
annotations: {}
210210
# -- Labels for the PVC
211-
labels:
211+
labels: {}
212212

213213
# -- Use the CrunchyData PostgreSQL Operator to create a PostgreSQL database
214214
crunchyPgo:
@@ -534,6 +534,18 @@ config:
534534
# which can be configured by emptyDirs.temporaryDirectory.
535535
TemporaryDirectory: /tmp/Orthanc
536536

537+
# -- Path to the directory that holds the heavyweight files (i.e. the
538+
# -- raw DICOM instances).
539+
# -- NOTE: a PersistentVolumeClaim can be created for this path by
540+
# setting persistence.storage.enabled=true
541+
StorageDirectory: /var/lib/orthanc/storage
542+
# -- Path to the directory that holds the SQLite index (if unset, the
543+
# -- value of StorageDirectory is used). This index could be stored on
544+
# -- a RAM-drive or a SSD device for performance reasons.
545+
# -- NOTE: a PersistentVolumeClaim can be created for this path by
546+
# setting persistence.index.enabled=true
547+
IndexDirectory: /var/lib/orthanc/index
548+
537549
metrics:
538550
# -- Enables the Prometheus metrics endpoint of Orthanc.
539551
# -- metrics.enabled is an alias for config.MetricsEnabled.

0 commit comments

Comments
 (0)