update nfs driver for kube 1.14

This commit is contained in:
Mathusan Selvarajah 2019-04-15 11:21:36 -04:00
parent f55eb4f5cb
commit 959bfe4201
3 changed files with 30 additions and 5 deletions

View File

@ -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),
}
}

View File

@ -72,7 +72,7 @@ func (d *driver) Run() {
csicommon.NewDefaultIdentityServer(d.csiDriver), csicommon.NewDefaultIdentityServer(d.csiDriver),
// NFS plugin has not implemented ControllerServer // NFS plugin has not implemented ControllerServer
// using default controllerserver. // using default controllerserver.
csicommon.NewDefaultControllerServer(d.csiDriver), getControllerServer(d.csiDriver),
NewNodeServer(d)) NewNodeServer(d))
s.Wait() s.Wait()
} }

View File

@ -22,13 +22,11 @@ import (
"strings" "strings"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/kubernetes-csi/drivers/pkg/csi-common"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume/util"
"github.com/kubernetes-csi/drivers/pkg/csi-common"
) )
type nodeServer struct { type nodeServer struct {
@ -92,7 +90,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
return nil, status.Error(codes.NotFound, "Volume not mounted") 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 { if err != nil {
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
@ -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) { func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
return &csi.NodeStageVolumeResponse{}, nil return &csi.NodeStageVolumeResponse{}, nil
} }
func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "")
}