Skip to content

Commit

Permalink
Merge ff648c0 into 494ace4
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheng Pan committed Feb 13, 2019
2 parents 494ace4 + ff648c0 commit 39e1d1f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 38 deletions.
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package main
import (
"flag"

"github.com/golang/glog"
"github.com/kubernetes-sigs/aws-fsx-csi-driver/pkg/driver"
"k8s.io/klog"
)

func main() {
Expand All @@ -29,6 +29,6 @@ func main() {

drv := driver.NewDriver(*endpoint)
if err := drv.Run(); err != nil {
glog.Fatalln(err)
klog.Fatalln(err)
}
}
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ require (
github.com/aws/aws-sdk-go v1.16.5
github.com/container-storage-interface/spec v0.3.0
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.2.0
github.com/kubernetes-csi/csi-test v0.3.0-2
github.com/onsi/ginkgo v1.7.0
github.com/onsi/gomega v1.4.3
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.1.0 // indirect
github.com/stretchr/testify v1.2.1 // indirect
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
google.golang.org/grpc v1.16.0
k8s.io/apimachinery v0.0.0-20190205091131-4b4ea28f2790
k8s.io/klog v0.1.0 // indirect
k8s.io/klog v0.1.0
k8s.io/kubernetes v1.13.1
k8s.io/utils v0.0.0-20181115163542-0d26856f57b3 // indirect
)
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ github.com/aws/aws-sdk-go v1.16.5/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/container-storage-interface/spec v0.3.0 h1:ALxSqFjptj8R5rL+cdyAbwbaLHHXDL5pmp1qIh1b+38=
github.com/container-storage-interface/spec v0.3.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
Expand All @@ -28,18 +25,14 @@ github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/afero v1.1.0 h1:bopulORc2JeYaxfHLvJa5NzxviA9PoWhpiiJkru7Ji4=
github.com/spf13/afero v1.1.0/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U=
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
Expand All @@ -52,7 +45,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.16.0 h1:dz5IJGuC2BB7qXR5AyHNwAUBhZscK2xVez7mznh72sY=
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/fsx"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog"
)

const (
Expand Down Expand Up @@ -199,7 +199,7 @@ func (c *cloud) WaitForFileSystemAvailable(ctx context.Context, fileSystemId str
if err != nil {
return true, err
}
glog.V(4).Infof("WaitForFileSystemAvailable filesystem status is: %v", *fs.Lifecycle)
klog.V(4).Infof("WaitForFileSystemAvailable filesystem status is: %v", *fs.Lifecycle)
switch *fs.Lifecycle {
case "AVAILABLE":
return true, nil
Expand Down
16 changes: 8 additions & 8 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"strings"

csi "github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/golang/glog"
"github.com/kubernetes-sigs/aws-fsx-csi-driver/pkg/cloud"
"github.com/kubernetes-sigs/aws-fsx-csi-driver/pkg/util"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog"
)

var (
Expand All @@ -36,7 +36,7 @@ var (
)

func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
glog.V(4).Infof("CreateVolume: called with args %#v", req)
klog.V(4).Infof("CreateVolume: called with args %#v", req)
volName := req.GetName()
if len(volName) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume name not provided")
Expand Down Expand Up @@ -88,15 +88,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
}

func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
glog.V(4).Infof("DeleteVolume: called with args: %#v", req)
klog.V(4).Infof("DeleteVolume: called with args: %#v", req)
volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
}

if err := d.cloud.DeleteFileSystem(ctx, volumeID); err != nil {
if err == cloud.ErrNotFound {
glog.V(4).Infof("DeleteVolume: volume not found, returning with success")
klog.V(4).Infof("DeleteVolume: volume not found, returning with success")
return &csi.DeleteVolumeResponse{}, nil
}
return nil, status.Errorf(codes.Internal, "Could not delete volume ID %q: %v", volumeID, err)
Expand All @@ -113,7 +113,7 @@ func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.Control
}

func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
glog.V(4).Infof("ControllerGetCapabilities: called with args %#v", req)
klog.V(4).Infof("ControllerGetCapabilities: called with args %#v", req)
var caps []*csi.ControllerServiceCapability
for _, cap := range controllerCaps {
c := &csi.ControllerServiceCapability{
Expand All @@ -129,17 +129,17 @@ func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.Control
}

func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) {
glog.V(4).Infof("GetCapacity: called with args %#v", req)
klog.V(4).Infof("GetCapacity: called with args %#v", req)
return nil, status.Error(codes.Unimplemented, "")
}

func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
glog.V(4).Infof("ListVolumes: called with args %#v", req)
klog.V(4).Infof("ListVolumes: called with args %#v", req)
return nil, status.Error(codes.Unimplemented, "")
}

func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
glog.V(4).Infof("ValidateVolumeCapabilities: called with args %#v", req)
klog.V(4).Infof("ValidateVolumeCapabilities: called with args %#v", req)
volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
Expand Down
10 changes: 5 additions & 5 deletions pkg/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"net"

csi "github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/golang/glog"
"github.com/kubernetes-sigs/aws-fsx-csi-driver/pkg/cloud"
"github.com/kubernetes-sigs/aws-fsx-csi-driver/pkg/util"
"google.golang.org/grpc"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
)

Expand Down Expand Up @@ -60,7 +60,7 @@ type Driver struct {
func NewDriver(endpoint string) *Driver {
cloud, err := cloud.NewCloud()
if err != nil {
glog.Fatalln(err)
klog.Fatalln(err)
}

return &Driver{
Expand All @@ -85,7 +85,7 @@ func (d *Driver) Run() error {
logErr := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
resp, err := handler(ctx, req)
if err != nil {
glog.Errorf("GRPC error: %v", err)
klog.Errorf("GRPC error: %v", err)
}
return resp, err
}
Expand All @@ -98,12 +98,12 @@ func (d *Driver) Run() error {
csi.RegisterControllerServer(d.srv, d)
csi.RegisterNodeServer(d.srv, d)

glog.Infof("Listening for connections on address: %#v", listener.Addr())
klog.Infof("Listening for connections on address: %#v", listener.Addr())
return d.srv.Serve(listener)
}

func (d *Driver) Stop() {
glog.Infof("Stopping server")
klog.Infof("Stopping server")
d.srv.Stop()
}

Expand Down
18 changes: 9 additions & 9 deletions pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"os"

csi "github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/golang/glog"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog"
)

var (
Expand All @@ -40,7 +40,7 @@ func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolu
}

func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
glog.V(4).Infof("NodePublishVolume: called with args %+v", req)
klog.V(4).Infof("NodePublishVolume: called with args %+v", req)

volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
Expand Down Expand Up @@ -74,12 +74,12 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu
options = append(options, "ro")
}

glog.V(5).Infof("NodePublishVolume: creating dir %s", target)
klog.V(5).Infof("NodePublishVolume: creating dir %s", target)
if err := d.mounter.MakeDir(target); err != nil {
return nil, status.Errorf(codes.Internal, "Could not create dir %q: %v", target, err)
}

glog.V(5).Infof("NodePublishVolume: mounting %s at %s", source, target)
klog.V(5).Infof("NodePublishVolume: mounting %s at %s", source, target)
if err := d.mounter.Mount(source, target, "lustre", options); err != nil {
os.Remove(target)
return nil, status.Errorf(codes.Internal, "Could not mount %q at %q: %v", source, target, err)
Expand All @@ -89,7 +89,7 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu
}

func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
glog.V(4).Infof("NodeUnpublishVolume: called with args %+v", req)
klog.V(4).Infof("NodeUnpublishVolume: called with args %+v", req)

volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
Expand All @@ -100,7 +100,7 @@ func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublish
return nil, status.Error(codes.InvalidArgument, "Target path not provided")
}

glog.V(5).Infof("NodeUnpublishVolume: unmounting %s", target)
klog.V(5).Infof("NodeUnpublishVolume: unmounting %s", target)
err := d.mounter.Unmount(target)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not unmount %q: %v", target, err)
Expand All @@ -110,7 +110,7 @@ func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublish
}

func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
glog.V(4).Infof("NodeGetCapabilities: called with args %+v", req)
klog.V(4).Infof("NodeGetCapabilities: called with args %+v", req)
var caps []*csi.NodeServiceCapability
for _, cap := range nodeCaps {
c := &csi.NodeServiceCapability{
Expand All @@ -126,15 +126,15 @@ func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabi
}

func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
glog.V(4).Infof("NodeGetInfo: called with args %+v", req)
klog.V(4).Infof("NodeGetInfo: called with args %+v", req)

return &csi.NodeGetInfoResponse{
NodeId: d.nodeID,
}, nil
}

func (d *Driver) NodeGetId(ctx context.Context, req *csi.NodeGetIdRequest) (*csi.NodeGetIdResponse, error) {
glog.V(4).Infof("NodeGetId: called with args %+v", req)
klog.V(4).Infof("NodeGetId: called with args %+v", req)
return &csi.NodeGetIdResponse{
NodeId: d.nodeID,
}, nil
Expand Down

0 comments on commit 39e1d1f

Please sign in to comment.