diff options
| author | Viktor Kuzmin <kvaster@gmail.com> | 2021-09-28 23:06:05 +0300 |
|---|---|---|
| committer | Viktor Kuzmin <kvaster@gmail.com> | 2021-09-28 23:06:05 +0300 |
| commit | 5c2298bd215959d78c881e5d48d96569b83ab3c7 (patch) | |
| tree | 58bff4585789a6c3bc5fa5cd3f8c3370615e9c95 /pkg/driver/nodeserver.go | |
| parent | beba7b0d787c59fdbb394c1340302aa5ce3e5b93 (diff) | |
| download | seaweedfs-csi-driver-5c2298bd215959d78c881e5d48d96569b83ab3c7.tar.xz seaweedfs-csi-driver-5c2298bd215959d78c881e5d48d96569b83ab3c7.zip | |
Allow static persistent volumes, some code cleanup
Diffstat (limited to 'pkg/driver/nodeserver.go')
| -rw-r--r-- | pkg/driver/nodeserver.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/driver/nodeserver.go b/pkg/driver/nodeserver.go index 71f40ba..8d2277a 100644 --- a/pkg/driver/nodeserver.go +++ b/pkg/driver/nodeserver.go @@ -2,6 +2,7 @@ package driver import ( "context" + "fmt" "os" "strings" @@ -50,14 +51,19 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis return &csi.NodePublishVolumeResponse{}, nil } - mo := req.GetVolumeCapability().GetMount().GetMountFlags() - if req.GetReadonly() { - mo = append(mo, "ro") + volContext := req.GetVolumeContext() + + path, ok := volContext["path"] + if !ok { + path = fmt.Sprintf("/buckets/%s", volumeID) } - volContext := req.GetVolumeContext() + collection, ok := volContext["collection"] + if !ok { + collection = volumeID + } - mounter, err := newMounter(volumeID, ns.Driver, volContext) + mounter, err := newMounter(path, collection, req.GetReadonly(), ns.Driver, volContext) if err != nil { return nil, err } |
