Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volumeMount and NFS mount clash when trying to use NFS for primary data storage #552

Open
miguemely opened this issue Apr 3, 2024 · 8 comments
Labels
needs info Not enough information provided NFS to group together all NFS related issues Persistence Anything to do with external storage or persistence. This is also where we triage things like NFS.

Comments

@miguemely
Copy link

miguemely commented Apr 3, 2024

Could be related to #264 and #531
Originally posted by @miguemely in #264 (comment)

So I'm trying to deploy this helm chart to replace my old install that uses NFS.

On the old install, it mounts a NFS share to /ncdata (Nextcloud Data Directory). This is what is defined in the Nextcloud config as its "Data Directory".

Within the helm values, I defined the following:
nextcloud.datadir: /ncdata
nextcloud.extraVolumes:

 extraVolumes:
  - name: nfs
    nfs:
      server: "nfs-server"
      path: "/mnt/nfspath"
      readOnly: false
 extraVolumeMounts:
  - name: nfs
    mountPath: "/ncdata"

The error I get is Deployment.apps "nextcloud" is invalid: [spec.template.spec.containers[0].volumeMounts[7].mountPath: Invalid value: "/ncdata": must be unique, spec.template.spec.containers[1].volumeMounts[8].mountPath: Invalid value: "/ncdata": must be unique, spec.template.spec.containers[2].volumeMounts[7].mountPath: Invalid value: "/ncdata": must be unique, spec.template.spec.containers[3].volumeMounts[0].name: Not found: "nextcloud-data"

I'm noticing that when I do a dry run, it creates a volumeMount for nextcloud-main.

            - name: nextcloud-main
              mountPath: /ncdata
              subPath: data

Is there a way to tell it not to use/create that mountPath, and instead use the one I specified for NFS?

@miguemely miguemely changed the title Necroing this issue here (my apologies) volumeMount and NFS mount clash when trying to use NFS for primary data storage Apr 3, 2024
@jessebot jessebot added the Persistence Anything to do with external storage or persistence. This is also where we triage things like NFS. label May 1, 2024
@bcbrookman
Copy link

I've also been trying to get this to work. As you alluded to, it's because the value of nextcloud.datadir is always used as a mountPath here:

{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
- name: nextcloud-data
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }}
{{- else }}
- name: nextcloud-main
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }}
{{- end }}

I expect changes would be needed to allow for this common(?) use-case as it does not appear to be configurable in any way.

@jessebot jessebot added the NFS to group together all NFS related issues label Jul 1, 2024
@jessebot
Copy link
Collaborator

jessebot commented Jul 1, 2024

@bcbrookman or @miguemely I'd like to understand this a bit better. Would setting the persistence.nextcloudData.existingClaim help here? Here's where it is in values.yaml:

nextcloudData:
enabled: false
subPath:
annotations: {}
# storageClass: "-"
# existingClaim:
accessMode: ReadWriteOnce
size: 8Gi

And here's the pesistence docs we have right now. Please let me know if you think this won't work, and if not, what you'd like to see done instead. As this is a community maintained chart, we're always open to pull requests to improve the chart 💙

@jessebot jessebot added the needs info Not enough information provided label Jul 1, 2024
@Heavybullets8
Copy link

I was able to get this working by using an existing claim:

pvc.yaml

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nextcloud-pv
spec:
  storageClassName: nextcloud-nfs
  capacity:
    storage: 300Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /mnt/tank/cloud
    server: ${SECRET_TRUENAS_IP}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nextcloud-pvc
spec:
  storageClassName: nextcloud-nfs
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 300Gi

helmrelease.yaml

    nextcloud:
       ...
      datadir: /var/www/data
       ...
    persistence:
      enabled: true
      existingClaim: *app

      nextcloudData:
        enabled: true
        existingClaim: nextcloud-pvc

Notes:
I did have to chmod the data dir that was created to 0770 (on my NFS machine) with:

chmod /mnt/tank/cloud/data 0770

Afterwards I refreshed the page and everything came up fine.

@miguemely
Copy link
Author

miguemely commented Jul 2, 2024

@Heavybullets8 Not understanding you here, Did you apply those files before the helm chart or?

The other problem there is the subpath of data, if you have existing data, your basically SOL.

@miguemely
Copy link
Author

miguemely commented Jul 2, 2024

-snip-

nextcloudData:
enabled: false
subPath:
annotations: {}
# storageClass: "-"
# existingClaim:
accessMode: ReadWriteOnce
size: 8Gi

How exactly would this work? Would we provide the existing pvc in existingClaim??

@miguemely
Copy link
Author

Actually...ignore me. I just put two and two together (once I relooked at #552 (comment))

Let me give that a go...

@bcbrookman
Copy link

Thanks for the responses! I did see persistence.nextcloudData.existingClaim initially but hadn't considered it with an NFS volume. As @Heavybullets8 mentioned, using it with an NFS PV should work

@jessebot
Copy link
Collaborator

jessebot commented Jul 3, 2024

Happy to help :) Please let me know if everyone is all set, and if not, how we can help further 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Not enough information provided NFS to group together all NFS related issues Persistence Anything to do with external storage or persistence. This is also where we triage things like NFS.
Projects
None yet
Development

No branches or pull requests

4 participants