Skip to content

Commit

Permalink
update nfs driver for kube 1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathusan Selvarajah committed Apr 23, 2019
1 parent f55eb4f commit 959bfe4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
23 changes: 23 additions & 0 deletions pkg/nfs/controllerserver.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package nfs

import (
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/kubernetes-csi/drivers/pkg/csi-common"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

type ControllerServer struct {
*csicommon.DefaultControllerServer
}

func (cs ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "")
}

func getControllerServer(csiDriver *csicommon.CSIDriver) ControllerServer {
return ControllerServer{
csicommon.NewDefaultControllerServer(csiDriver),
}
}
2 changes: 1 addition & 1 deletion pkg/nfs/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (d *driver) Run() {
csicommon.NewDefaultIdentityServer(d.csiDriver),
// NFS plugin has not implemented ControllerServer
// using default controllerserver.
csicommon.NewDefaultControllerServer(d.csiDriver),
getControllerServer(d.csiDriver),
NewNodeServer(d))
s.Wait()
}
10 changes: 6 additions & 4 deletions pkg/nfs/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ import (
"strings"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/kubernetes-csi/drivers/pkg/csi-common"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume/util"

"github.com/kubernetes-csi/drivers/pkg/csi-common"
)

type nodeServer struct {
Expand Down Expand Up @@ -92,7 +90,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
return nil, status.Error(codes.NotFound, "Volume not mounted")
}

err = util.UnmountPath(req.GetTargetPath(), mount.New(""))
err = mount.CleanupMountPoint(req.GetTargetPath(), mount.New(""), false)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand All @@ -107,3 +105,7 @@ func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
return &csi.NodeStageVolumeResponse{}, nil
}

func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "")
}

0 comments on commit 959bfe4

Please sign in to comment.