From db517dbcbc524bec2856c65bbd9646ca1bf7cf5c Mon Sep 17 00:00:00 2001 From: "azykov@mail.ru" Date: Sun, 16 Aug 2026 20:42:10 +0300 Subject: [PATCH] fix for nfs-photo not exporting root dir --- clusters/base/apps/nfs-photo/helmrelease.yaml | 34 +++++++++++++------ clusters/base/apps/webdav/helmrelease.yaml | 2 +- .../storage-classes/kustomization.yaml | 1 + .../longhorn-single-replica.yaml | 12 +++++++ clusters/home/namespaces/kustomization.yaml | 1 + 5 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 clusters/base/infra/longhorn/storage-classes/longhorn-single-replica.yaml diff --git a/clusters/base/apps/nfs-photo/helmrelease.yaml b/clusters/base/apps/nfs-photo/helmrelease.yaml index f33e468..bc285e7 100644 --- a/clusters/base/apps/nfs-photo/helmrelease.yaml +++ b/clusters/base/apps/nfs-photo/helmrelease.yaml @@ -25,14 +25,6 @@ spec: - sh - -c - chmod -R a+rwX /disks/base /disks/sub1 - mtab-setup: - image: - repository: hectorm/nfs-ganesha - tag: v10 - command: - - sh - - -c - - cat /proc/self/mounts > /mtab-vol/mtab # native sidecar (restartPolicy: Always): mounts the two disks and # exposes their union at /disks/merged via FUSE. It must be up and # actually mounted *before* the "app" container is created, since @@ -46,7 +38,6 @@ spec: mergerfs: dependsOn: - fix-permissions - - mtab-setup restartPolicy: Always image: repository: ghcr.io/hotio/mergerfs @@ -77,6 +68,24 @@ spec: memory: 64Mi limits: memory: 512Mi + # runs after mergerfs is confirmed mounted (see dependsOn) and has + # /export mounted too, so the /proc/self/mounts snapshot it takes + # actually includes the fuse.mergerfs line for /export. ganesha's + # FSAL_VFS resolves export paths against this frozen /etc/mtab, not + # the live /proc/mounts - if /export is missing from it (e.g. this + # ran before mergerfs, or without /export mounted at all), ganesha + # fails at startup with "resolve_posix_filesystem(/export) ... + # No such file or directory" even though /export is mounted fine. + mtab-setup: + dependsOn: + - mergerfs + image: + repository: hectorm/nfs-ganesha + tag: v10 + command: + - sh + - -c + - cat /proc/self/mounts > /mtab-vol/mtab containers: app: image: @@ -141,7 +150,7 @@ spec: type: persistentVolumeClaim accessMode: ReadWriteOnce size: 100Gi - storageClass: longhorn + storageClass: longhorn-single-replica retain: true advancedMounts: app: @@ -153,7 +162,7 @@ spec: type: persistentVolumeClaim accessMode: ReadWriteOnce size: 100Gi - storageClass: longhorn + storageClass: longhorn-single-replica retain: true advancedMounts: app: @@ -171,6 +180,9 @@ spec: app: - path: /export mountPropagation: HostToContainer + mtab-setup: + - path: /export + mountPropagation: HostToContainer dev-fuse: type: hostPath hostPath: /dev/fuse diff --git a/clusters/base/apps/webdav/helmrelease.yaml b/clusters/base/apps/webdav/helmrelease.yaml index 15ca38a..099250b 100644 --- a/clusters/base/apps/webdav/helmrelease.yaml +++ b/clusters/base/apps/webdav/helmrelease.yaml @@ -94,7 +94,7 @@ spec: type: persistentVolumeClaim existingClaim: nfs-photo-export globalMounts: - - path: /webdav/photo + - path: /webdav/photo/library sda2: type: persistentVolumeClaim existingClaim: nas1-sda2 diff --git a/clusters/base/infra/longhorn/storage-classes/kustomization.yaml b/clusters/base/infra/longhorn/storage-classes/kustomization.yaml index 55227d2..9c9664b 100644 --- a/clusters/base/infra/longhorn/storage-classes/kustomization.yaml +++ b/clusters/base/infra/longhorn/storage-classes/kustomization.yaml @@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - longhorn-no-retain.yaml + - longhorn-single-replica.yaml diff --git a/clusters/base/infra/longhorn/storage-classes/longhorn-single-replica.yaml b/clusters/base/infra/longhorn/storage-classes/longhorn-single-replica.yaml new file mode 100644 index 0000000..2e26418 --- /dev/null +++ b/clusters/base/infra/longhorn/storage-classes/longhorn-single-replica.yaml @@ -0,0 +1,12 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: longhorn-single-replica + annotations: + storageclass.kubernetes.io/is-default-class: "false" +provisioner: driver.longhorn.io +reclaimPolicy: Retain +allowVolumeExpansion: true +parameters: + numberOfReplicas: "1" + staleReplicaTimeout: "30" diff --git a/clusters/home/namespaces/kustomization.yaml b/clusters/home/namespaces/kustomization.yaml index 8a8d849..cb7ffb7 100644 --- a/clusters/home/namespaces/kustomization.yaml +++ b/clusters/home/namespaces/kustomization.yaml @@ -15,3 +15,4 @@ resources: - ../../base/namespaces/finance.yaml - ../../base/namespaces/nfs.yaml - ../../base/namespaces/syncthing.yaml + - ../../base/namespaces/photo-stats.yaml