Skip to content

Commit 638bfc6

Browse files
authored
feat(nextcloud): added hostPath volumes option (#827)
Signed-off-by: Ben <ben.zhao@benzhao.dev>
1 parent 8a55938 commit 638bfc6

File tree

6 files changed

+50
-26
lines changed

6 files changed

+50
-26
lines changed

charts/nextcloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: nextcloud
3-
version: 8.8.2
3+
version: 8.9.0
44
# renovate: image=docker.io/library/nextcloud
55
appVersion: 32.0.5
66
description: A file sharing server that puts the control and security of your own data back into your hands.

charts/nextcloud/README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -397,22 +397,24 @@ The [Nextcloud](https://hub.docker.com/_/nextcloud/) image stores the nextcloud
397397
Persistent Volume Claims are used to keep the data across deployments. This is known to work with GKE, EKS, K3s, and minikube.
398398
Nextcloud will *not* delete the PVCs when uninstalling the helm chart.
399399

400-
| Parameter | Description | Default |
401-
| ----------------------------------------- | ---------------------------------------------------- | --------------- |
402-
| `persistence.enabled` | Enable persistence using PVC | `false` |
403-
| `persistence.annotations` | PVC annotations | `{}` |
404-
| `persistence.labels` | PVC labels | `{}` |
405-
| `persistence.storageClass` | PVC Storage Class for nextcloud volume | `nil` |
406-
| `persistence.existingClaim` | An Existing PVC name for nextcloud volume | `nil` |
407-
| `persistence.accessMode` | PVC Access Mode for nextcloud volume | `ReadWriteOnce` |
408-
| `persistence.size` | PVC Storage Request for nextcloud volume | `8Gi` |
409-
| `persistence.nextcloudData.enabled` | Create a second PVC for the data folder in nextcloud | `false` |
410-
| `persistence.nextcloudData.annotations` | see `persistence.annotations` | `{}` |
411-
| `persistence.nextcloudData.labels` | see `persistence.labels` | `{}` |
412-
| `persistence.nextcloudData.storageClass` | see `persistence.storageClass` | `nil` |
413-
| `persistence.nextcloudData.existingClaim` | see `persistence.existingClaim` | `nil` |
414-
| `persistence.nextcloudData.accessMode` | see `persistence.accessMode` | `ReadWriteOnce` |
415-
| `persistence.nextcloudData.size` | see `persistence.size` | `8Gi` |
400+
| Parameter | Description | Default |
401+
|-------------------------------------------|---------------------------------------------------------|-----------------|
402+
| `persistence.enabled` | Enable persistence using PVC | `false` |
403+
| `persistence.hostPath` | Path on the host where nextcloud data is stored | `nil` |
404+
| `persistence.annotations` | PVC annotations | `{}` |
405+
| `persistence.labels` | PVC labels | `{}` |
406+
| `persistence.storageClass` | PVC Storage Class for nextcloud volume | `nil` |
407+
| `persistence.existingClaim` | An Existing PVC name for nextcloud volume | `nil` |
408+
| `persistence.accessMode` | PVC Access Mode for nextcloud volume | `ReadWriteOnce` |
409+
| `persistence.size` | PVC Storage Request for nextcloud volume | `8Gi` |
410+
| `persistence.nextcloudData.enabled` | Create a second PVC for the data folder in nextcloud | `false` |
411+
| `persistence.nextcloudData.hostPath` | Path on the host where nextcloud data is stored | `nil` |
412+
| `persistence.nextcloudData.annotations` | see `persistence.annotations` | `{}` |
413+
| `persistence.nextcloudData.labels` | see `persistence.labels` | `{}` |
414+
| `persistence.nextcloudData.storageClass` | see `persistence.storageClass` | `nil` |
415+
| `persistence.nextcloudData.existingClaim` | see `persistence.existingClaim` | `nil` |
416+
| `persistence.nextcloudData.accessMode` | see `persistence.accessMode` | `ReadWriteOnce` |
417+
| `persistence.nextcloudData.size` | see `persistence.size` | `8Gi` |
416418

417419
### Metrics Configurations
418420

charts/nextcloud/templates/deployment.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,27 @@ spec:
351351
volumes:
352352
- name: nextcloud-main
353353
{{- if .Values.persistence.enabled }}
354+
{{- with .Values.persistence.hostPath }}
355+
hostPath:
356+
path: {{ . }}
357+
type: Directory
358+
{{- else }}
354359
persistentVolumeClaim:
355-
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }}
360+
claimName: {{ with .Values.persistence.existingClaim }}{{ . }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }}
361+
{{- end }}
356362
{{- else }}
357363
emptyDir: {}
358364
{{- end }}
359365
{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
360366
- name: nextcloud-data
367+
{{- with .Values.persistence.nextcloudData.hostPath }}
368+
hostPath:
369+
path: {{ . }}
370+
type: Directory
371+
{{- else }}
361372
persistentVolumeClaim:
362-
claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }}
373+
claimName: {{ with .Values.persistence.nextcloudData.existingClaim }}{{ . }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }}
374+
{{- end }}
363375
{{- end }}
364376
{{- if .Values.nextcloud.configs }}
365377
- name: nextcloud-config

charts/nextcloud/templates/nextcloud-data-pvc.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled (not .Values.persistence.nextcloudData.existingClaim) }}
1+
{{- if and
2+
.Values.persistence.enabled
3+
.Values.persistence.nextcloudData.enabled
4+
(not .Values.persistence.nextcloudData.hostPath)
5+
(not .Values.persistence.nextcloudData.existingClaim)
6+
}}
27
---
38
kind: PersistentVolumeClaim
49
apiVersion: v1
@@ -21,10 +26,6 @@ spec:
2126
requests:
2227
storage: {{ .Values.persistence.nextcloudData.size | quote }}
2328
{{- with .Values.persistence.nextcloudData.storageClass }}
24-
{{- if (eq "-" .) }}
25-
storageClassName: ""
26-
{{- else }}
27-
storageClassName: "{{ . }}"
28-
{{- end }}
29+
storageClassName: {{ ternary "" . (eq "-" .) }}
2930
{{- end }}
3031
{{- end }}

charts/nextcloud/templates/nextcloud-pvc.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
1+
{{- if and
2+
.Values.persistence.enabled
3+
(not .Values.persistence.hostPath)
4+
(not .Values.persistence.existingClaim)
5+
}}
26
kind: PersistentVolumeClaim
37
apiVersion: v1
48
metadata:

charts/nextcloud/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,15 @@ persistence:
778778
accessMode: ReadWriteOnce
779779
size: 8Gi
780780

781+
# -- If defined, use a hostPath volume for nextcloud data rather than a dynamically defined PVC.
782+
hostPath:
783+
781784
## Use an additional pvc for the data directory rather than a subpath of the default PVC
782785
## Useful to store data on a different storageClass (e.g. on slower disks)
783786
nextcloudData:
784787
enabled: false
788+
# -- If defined, use a hostPath volume for nextcloud data rather than a dynamically defined PVC.
789+
hostPath:
785790
subPath:
786791
labels: {}
787792
annotations: {}

0 commit comments

Comments
 (0)