From d59897dc5cdaeeafa4de062c143f9e1ba03559a0 Mon Sep 17 00:00:00 2001 From: "azykov@mail.ru" Date: Sat, 15 Aug 2026 17:26:55 +0300 Subject: [PATCH] nfs-photo --- clusters/base/apps/nfs-photo/configmap.yaml | 51 +++++ clusters/base/apps/nfs-photo/helmrelease.yaml | 177 ++++++++++++++++++ .../base/apps/nfs-photo/helmrepository.yaml | 10 + .../base/apps/nfs-photo/kustomization.yaml | 6 + clusters/base/apps/webdav/helmrelease.yaml | 5 + clusters/base/apps/webdav/pv-pvc-data.yaml | 36 ++++ clusters/home/apps/kustomization.yaml | 3 +- clusters/home/apps/nfs-photo.yaml | 17 ++ clusters/home/apps/webdav.yaml | 1 + 9 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 clusters/base/apps/nfs-photo/configmap.yaml create mode 100644 clusters/base/apps/nfs-photo/helmrelease.yaml create mode 100644 clusters/base/apps/nfs-photo/helmrepository.yaml create mode 100644 clusters/base/apps/nfs-photo/kustomization.yaml create mode 100644 clusters/home/apps/nfs-photo.yaml diff --git a/clusters/base/apps/nfs-photo/configmap.yaml b/clusters/base/apps/nfs-photo/configmap.yaml new file mode 100644 index 0000000..f70a151 --- /dev/null +++ b/clusters/base/apps/nfs-photo/configmap.yaml @@ -0,0 +1,51 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nfs-photo-config + namespace: nfs +data: + ganesha.conf: | + NFS_Core_Param { + NFS_Port = 2049; + Protocols = NFSv4; + Fsid_Device = true; + } + + NFSV4 { + RecoveryBackend = fs_ng; + RecoveryRoot = /recovery; + Lease_Lifetime = 40; + Grace_Period = 50; + } + + VFS { + Link_Support = true; + Symlink_Support = true; + CanSetTime = true; + umask = 0000; + } + + EXPORT { + Export_Id = 1; + + Path = /export; + Pseudo = /export; + + SecType = sys; + Protocols = NFSv4; + + FSAL { + Name = VFS; + } + + CLIENT { + Clients = *; + Access_Type = RW; + Squash = No_Root_Squash; + Protocols = NFSv4; + } + } + + LOG { + Default_Log_Level = INFO; + } diff --git a/clusters/base/apps/nfs-photo/helmrelease.yaml b/clusters/base/apps/nfs-photo/helmrelease.yaml new file mode 100644 index 0000000..6eb737b --- /dev/null +++ b/clusters/base/apps/nfs-photo/helmrelease.yaml @@ -0,0 +1,177 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: nfs-photo + namespace: nfs +spec: + interval: 30m + chartRef: + kind: OCIRepository + name: nfs-photo + driftDetection: + mode: enabled + values: + controllers: + app: + strategy: Recreate + podDisruptionBudget: + maxUnavailable: "0" + initContainers: + fix-permissions: + image: + repository: hectorm/nfs-ganesha + tag: v10 + command: + - 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 + containers: + # mounts the two disks and exposes their union at /disks/merged via FUSE; + # bidirectional propagation makes that mount visible to the "app" + # (ganesha) container so it can export it over NFS. + mergerfs: + image: + repository: ghcr.io/hotio/mergerfs + tag: release-v2.42.0 + args: + - "-o" + - "allow_other,use_ino,func.create=ff,category.action=all,category.create=ff,category.search=ff" + - "/disks/base:/disks/sub1" + - "/disks/merged" + securityContext: + privileged: true + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + memory: 512Mi + app: + image: + repository: hectorm/nfs-ganesha + tag: v10 + securityContext: + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + add: + - CHOWN + - DAC_OVERRIDE + - DAC_READ_SEARCH + - FOWNER + - FSETID + - SETGID + - SETUID + - SYS_RESOURCE + probes: + liveness: + enabled: true + spec: + initialDelaySeconds: 2 + periodSeconds: 10 + timeoutSeconds: 2 + failureThreshold: 3 + readiness: + enabled: true + spec: + initialDelaySeconds: 1 + periodSeconds: 2 + timeoutSeconds: 1 + failureThreshold: 2 + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + memory: 512Mi + + service: + app: + controller: app + # cluster-internal only, consumed by webdav via + # nfs-photo.nfs.svc.cluster.local + type: ClusterIP + ports: + nfs: + port: 2049 + protocol: TCP + + persistence: + config: + type: configMap + name: nfs-photo-config + globalMounts: + - path: /etc/ganesha/ganesha.conf + subPath: ganesha.conf + readOnly: true + base: + type: persistentVolumeClaim + accessMode: ReadWriteOnce + size: 100Gi + storageClass: longhorn + retain: true + advancedMounts: + app: + mergerfs: + - path: /disks/base + fix-permissions: + - path: /disks/base + sub1: + type: persistentVolumeClaim + accessMode: ReadWriteOnce + size: 100Gi + storageClass: longhorn + retain: true + advancedMounts: + app: + mergerfs: + - path: /disks/sub1 + fix-permissions: + - path: /disks/sub1 + merged: + type: emptyDir + advancedMounts: + app: + mergerfs: + - path: /disks/merged + mountPropagation: Bidirectional + app: + - path: /export + mountPropagation: HostToContainer + dev-fuse: + type: hostPath + hostPath: /dev/fuse + advancedMounts: + app: + mergerfs: + - path: /dev/fuse + run: + type: emptyDir + globalMounts: + - path: /run + tmp: + type: emptyDir + globalMounts: + - path: /tmp + recovery: + type: emptyDir + globalMounts: + - path: /recovery + etc-mtab: + type: emptyDir + advancedMounts: + app: + app: + - path: /etc/mtab + subPath: mtab + mtab-setup: + - path: /mtab-vol diff --git a/clusters/base/apps/nfs-photo/helmrepository.yaml b/clusters/base/apps/nfs-photo/helmrepository.yaml new file mode 100644 index 0000000..7df387a --- /dev/null +++ b/clusters/base/apps/nfs-photo/helmrepository.yaml @@ -0,0 +1,10 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: OCIRepository +metadata: + name: nfs-photo + namespace: nfs +spec: + interval: 1h + url: oci://ghcr.io/bjw-s-labs/helm/app-template + ref: + tag: "5.0.1" diff --git a/clusters/base/apps/nfs-photo/kustomization.yaml b/clusters/base/apps/nfs-photo/kustomization.yaml new file mode 100644 index 0000000..eea457f --- /dev/null +++ b/clusters/base/apps/nfs-photo/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - helmrepository.yaml + - configmap.yaml + - helmrelease.yaml diff --git a/clusters/base/apps/webdav/helmrelease.yaml b/clusters/base/apps/webdav/helmrelease.yaml index de1a244..15ca38a 100644 --- a/clusters/base/apps/webdav/helmrelease.yaml +++ b/clusters/base/apps/webdav/helmrelease.yaml @@ -90,6 +90,11 @@ spec: existingClaim: ganesha-export globalMounts: - path: /webdav/export + photo: + type: persistentVolumeClaim + existingClaim: nfs-photo-export + globalMounts: + - path: /webdav/photo sda2: type: persistentVolumeClaim existingClaim: nas1-sda2 diff --git a/clusters/base/apps/webdav/pv-pvc-data.yaml b/clusters/base/apps/webdav/pv-pvc-data.yaml index bf298df..33db217 100644 --- a/clusters/base/apps/webdav/pv-pvc-data.yaml +++ b/clusters/base/apps/webdav/pv-pvc-data.yaml @@ -36,6 +36,42 @@ spec: --- apiVersion: v1 kind: PersistentVolume +metadata: + name: nfs-photo-export-nfs +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + storageClassName: "" + mountOptions: + - nfsvers=4.1 + nfs: + server: nfs-photo.nfs.svc.cluster.local + path: /export + claimRef: + namespace: webdav + name: nfs-photo-export +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nfs-photo-export + namespace: webdav + annotations: + helm.sh/resource-policy: keep +spec: + accessModes: + - ReadWriteMany + storageClassName: "" + volumeName: nfs-photo-export-nfs + resources: + requests: + storage: 200Gi +--- +apiVersion: v1 +kind: PersistentVolume metadata: name: nas1-sda2-nfs spec: diff --git a/clusters/home/apps/kustomization.yaml b/clusters/home/apps/kustomization.yaml index fffb412..5e191bb 100644 --- a/clusters/home/apps/kustomization.yaml +++ b/clusters/home/apps/kustomization.yaml @@ -13,4 +13,5 @@ resources: - webdav.yaml - fava.yaml - infcloud.yaml - - syncthing.yaml \ No newline at end of file + - syncthing.yaml + - nfs-photo.yaml \ No newline at end of file diff --git a/clusters/home/apps/nfs-photo.yaml b/clusters/home/apps/nfs-photo.yaml new file mode 100644 index 0000000..890a480 --- /dev/null +++ b/clusters/home/apps/nfs-photo.yaml @@ -0,0 +1,17 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: nfs-photo + namespace: flux-system +spec: + interval: 10m + sourceRef: + kind: GitRepository + name: flux-system + path: ./clusters/base/apps/nfs-photo + prune: true + wait: true + dependsOn: + - name: namespaces + - name: infra + retryInterval: 5s diff --git a/clusters/home/apps/webdav.yaml b/clusters/home/apps/webdav.yaml index cbf073a..6a6c6cf 100644 --- a/clusters/home/apps/webdav.yaml +++ b/clusters/home/apps/webdav.yaml @@ -14,6 +14,7 @@ spec: dependsOn: - name: namespaces - name: nfs-ganesha + - name: nfs-photo retryInterval: 5s decryption: provider: sops