From 8ac903edd69c6bfb676d1017692d3e17b3bffd17 Mon Sep 17 00:00:00 2001 From: Tasko Olevski Date: Wed, 5 Feb 2025 18:32:00 +0100 Subject: [PATCH] squashme: minor fix --- pkg/rclone/driver.go | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/pkg/rclone/driver.go b/pkg/rclone/driver.go index edd3b7c..3ee3075 100644 --- a/pkg/rclone/driver.go +++ b/pkg/rclone/driver.go @@ -63,27 +63,6 @@ func NewDriver(nodeID, endpoint string) *Driver { return d } -func newNodeServer(d *Driver, rcloneOps Operations) *nodeServer { - return &nodeServer{ - // Creating and passing the NewDefaultNodeServer is useless and unecessary - DefaultNodeServer: csicommon.NewDefaultNodeServer(d.csiDriver), - mounter: &mount.SafeFormatAndMount{ - Interface: mount.New(""), - Exec: utilexec.New(), - }, - RcloneOps: rcloneOps, - } -} - -func newControllerServer(d *Driver) *controllerServer { - return &controllerServer{ - // Creating and passing the NewDefaultControllerServer is useless and unecessary - DefaultControllerServer: csicommon.NewDefaultControllerServer(d.csiDriver), - active_volumes: map[string]int64{}, - mutex: sync.RWMutex{}, - } -} - func (d *Driver) RunNodeService() error { kubeClient, err := kube.GetK8sClient() if err != nil { @@ -97,7 +76,14 @@ func (d *Driver) RunNodeService() error { rcloneOps := NewRclone(kubeClient, rclonePort) s := csicommon.NewNonBlockingGRPCServer() - ns := newNodeServer(d, rcloneOps) + ns := &nodeServer{ + DefaultNodeServer: csicommon.NewDefaultNodeServer(d.csiDriver), + mounter: &mount.SafeFormatAndMount{ + Interface: mount.New(""), + Exec: utilexec.New(), + }, + RcloneOps: rcloneOps, + } s.Start( d.endpoint, csicommon.NewDefaultIdentityServer(d.csiDriver), @@ -115,10 +101,15 @@ func (d *Driver) RunControllerService() error { s.Start( d.endpoint, csicommon.NewDefaultIdentityServer(d.csiDriver), - newControllerServer(d), + &controllerServer{ + DefaultControllerServer: csicommon.NewDefaultControllerServer(d.csiDriver), + active_volumes: map[string]int64{}, + mutex: sync.RWMutex{}, + }, nil, ) d.Server = s + s.Wait() return nil }