From f292fb147fb04f857596a0c7bd2ddfef788e52e2 Mon Sep 17 00:00:00 2001 From: chrislusf Date: Fri, 5 Dec 2025 18:44:43 -0800 Subject: fix: address code review feedback - CRITICAL: Make socket path configurable based on mountEndpoint - Added volumeSocketDir field to SeaweedFsDriver - LocalSocketPath now accepts baseDir parameter - Derived from mountEndpoint for user-configurable socket paths - HIGH: Pin seaweedfs version in Dockerfiles for reproducible builds - Added SEAWEEDFS_VERSION build arg (default: 3.80) - Clone specific tag instead of master - HIGH: Fix Dockerfile.dev to use local context instead of personal fork - Removed hardcoded zemul/seaweedfs-csi-driver clone - Now uses COPY . . for local development - HIGH: Change :latest to :dev in kubernetes manifests - Mutable :latest tag replaced with :dev for predictability - MEDIUM: Remove Aliyun mirror from Dockerfile.dev - Region-specific mirrors shouldn't be in general-purpose files - MEDIUM: Improve error handling in client.go - Now reports read errors when failing to read error response body - MEDIUM: Fix inconsistent error return in manager.go - Return nil instead of empty struct on error (Go idiom) --- pkg/mountmanager/socket.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pkg/mountmanager/socket.go') diff --git a/pkg/mountmanager/socket.go b/pkg/mountmanager/socket.go index 1b8a079..f327dcb 100644 --- a/pkg/mountmanager/socket.go +++ b/pkg/mountmanager/socket.go @@ -2,15 +2,23 @@ package mountmanager import ( "fmt" + "path/filepath" "github.com/seaweedfs/seaweedfs/weed/util" ) +// DefaultSocketDir is the default directory for volume sockets. +const DefaultSocketDir = "/var/lib/seaweedfs-mount" + // LocalSocketPath returns the unix socket path used to communicate with the weed mount process. -func LocalSocketPath(volumeID string) string { +// The baseDir parameter should be the directory where sockets are stored (e.g., derived from mountEndpoint). +func LocalSocketPath(baseDir, volumeID string) string { + if baseDir == "" { + baseDir = DefaultSocketDir + } hash := util.HashToInt32([]byte(volumeID)) if hash < 0 { hash = -hash } - return fmt.Sprintf("/var/lib/seaweedfs-mount/seaweedfs-mount-%d.sock", hash) + return filepath.Join(baseDir, fmt.Sprintf("seaweedfs-mount-%d.sock", hash)) } -- cgit v1.2.3