From b5c8c33f20d26c09e3eca0a60d39fb123a0ac7e6 Mon Sep 17 00:00:00 2001 From: Shawn <32839114+enwaiax@users.noreply.github.com> Date: Mon, 15 Dec 2025 13:33:44 +0800 Subject: [PATCH] feat: add configurable NFS storage path - Add nfs_path variable to version config templates (14.x, 15.x, 16.0) - Use Jinja2 default filter in add-ons.yaml for backward compatibility - Default path remains /data/nfs Users can now customize NFS storage path by setting nfs_path in cns_values.yaml" --- playbooks/add-ons.yaml | 10 +++++----- playbooks/cns_values_14.0.yaml | 2 ++ playbooks/cns_values_14.1.yaml | 2 ++ playbooks/cns_values_14.2.yaml | 2 ++ playbooks/cns_values_15.0.yaml | 2 ++ playbooks/cns_values_15.1.yaml | 2 ++ playbooks/cns_values_16.0.yaml | 2 ++ 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/playbooks/add-ons.yaml b/playbooks/add-ons.yaml index a06ced23..55be336e 100644 --- a/playbooks/add-ons.yaml +++ b/playbooks/add-ons.yaml @@ -55,9 +55,9 @@ block: - name: Setup Mounts for NFS shell: | - mkdir -p /data/nfs - chown nobody:nogroup /data/nfs - chmod 2770 /data/nfs + mkdir -p {{ nfs_path | default('/data/nfs') }} + chown nobody:nogroup {{ nfs_path | default('/data/nfs') }} + chmod 2770 {{ nfs_path | default('/data/nfs') }} retries: 5 delay: 5 register: setup_nfs_mounts @@ -67,7 +67,7 @@ lineinfile: path: /etc/exports insertafter: EOF - line: "/data/nfs *(rw,sync,no_subtree_check,no_root_squash,insecure)" + line: "{{ nfs_path | default('/data/nfs') }} *(rw,sync,no_subtree_check,no_root_squash,insecure)" retries: 5 delay: 5 register: update_nfs_exports @@ -109,7 +109,7 @@ shell: | helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner --force-update helm repo update - helm install --version {{ nfs_provisioner }} nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server={{ ansible_default_ipv4.address }} --set nfs.path=/data/nfs --set storageClass.archiveOnDelete=false --create-namespace --namespace nfs-client + helm install --version {{ nfs_provisioner }} nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server={{ ansible_default_ipv4.address }} --set nfs.path={{ nfs_path | default('/data/nfs') }} --set storageClass.archiveOnDelete=false --create-namespace --namespace nfs-client sleep 10 kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' retries: 5 diff --git a/playbooks/cns_values_14.0.yaml b/playbooks/cns_values_14.0.yaml index 95581095..7ac4a010 100644 --- a/playbooks/cns_values_14.0.yaml +++ b/playbooks/cns_values_14.0.yaml @@ -99,6 +99,8 @@ lws: no # Local Path Provisioner and NFS Provisoner as Storage option storage: no +# NFS storage path +nfs_path: "/data/nfs" # Monitoring Stack Prometheus/Grafana with GPU Metrics and Elastic Logging stack monitoring: no diff --git a/playbooks/cns_values_14.1.yaml b/playbooks/cns_values_14.1.yaml index c83341da..b700783d 100644 --- a/playbooks/cns_values_14.1.yaml +++ b/playbooks/cns_values_14.1.yaml @@ -99,6 +99,8 @@ lws: no # Local Path Provisioner and NFS Provisoner as Storage option storage: no +# NFS storage path +nfs_path: "/data/nfs" # Monitoring Stack Prometheus/Grafana with GPU Metrics and Elastic Logging stack monitoring: no diff --git a/playbooks/cns_values_14.2.yaml b/playbooks/cns_values_14.2.yaml index be0ed102..ce0b10af 100755 --- a/playbooks/cns_values_14.2.yaml +++ b/playbooks/cns_values_14.2.yaml @@ -99,6 +99,8 @@ lws: no # Local Path Provisioner and NFS Provisoner as Storage option storage: no +# NFS storage path +nfs_path: "/data/nfs" # Monitoring Stack Prometheus/Grafana with GPU Metrics and Elastic Logging stack monitoring: no diff --git a/playbooks/cns_values_15.0.yaml b/playbooks/cns_values_15.0.yaml index 04dcf30d..11bb7a72 100644 --- a/playbooks/cns_values_15.0.yaml +++ b/playbooks/cns_values_15.0.yaml @@ -99,6 +99,8 @@ lws: no # Local Path Provisioner and NFS Provisoner as Storage option storage: no +# NFS storage path +nfs_path: "/data/nfs" # Monitoring Stack Prometheus/Grafana with GPU Metrics and Elastic Logging stack monitoring: no diff --git a/playbooks/cns_values_15.1.yaml b/playbooks/cns_values_15.1.yaml index 08c2e3e3..30508c6f 100644 --- a/playbooks/cns_values_15.1.yaml +++ b/playbooks/cns_values_15.1.yaml @@ -99,6 +99,8 @@ lws: no # Local Path Provisioner and NFS Provisoner as Storage option storage: no +# NFS storage path +nfs_path: "/data/nfs" # Monitoring Stack Prometheus/Grafana with GPU Metrics and Elastic Logging stack monitoring: no diff --git a/playbooks/cns_values_16.0.yaml b/playbooks/cns_values_16.0.yaml index 5d820f1f..b270e06a 100644 --- a/playbooks/cns_values_16.0.yaml +++ b/playbooks/cns_values_16.0.yaml @@ -99,6 +99,8 @@ lws: no # Local Path Provisioner and NFS Provisoner as Storage option storage: no +# NFS storage path +nfs_path: "/data/nfs" # Monitoring Stack Prometheus/Grafana with GPU Metrics and Elastic Logging stack monitoring: no