# NFS CSI Volume Definition for Nomad
# 这个文件定义了CSI volume，让NFS存储能在Nomad UI中显示

volume "nfs-shared-csi" {
  type = "csi"
  
  # CSI plugin名称
  source = "csi-nfs"
  
  # 容量设置
  capacity_min = "1GiB"
  capacity_max = "10TiB"
  
  # 访问模式 - 支持多节点读写
  access_mode = "multi-node-multi-writer"
  
  # 挂载选项
  mount_options {
    fs_type = "nfs4"
    mount_flags = "rw,relatime,vers=4.2"
  }
  
  # 拓扑约束 - 确保在有NFS挂载的节点上运行
  topology_request {
    required {
      topology {
        "node" = "{{ range $node := nomadNodes }}{{ if eq $node.Status "ready" }}{{ $node.Name }}{{ end }}{{ end }}"
      }
    }
  }
  
  # 卷参数
  parameters {
    server = "snail"
    share = "/fs/1000/nfs/Fnsync"
  }
}






