Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to CSI 1.0.0 #6

Merged
merged 4 commits into from
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

[[constraint]]
name = "github.com/container-storage-interface/spec"
version = "~0.3.0"
version = "1.0.0"

[[constraint]]
branch = "master"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

REGISTRY_NAME=andyzhangx
IMAGE_NAME=azurefile-csi
IMAGE_VERSION=v0.1.0-alpha
IMAGE_VERSION=v0.2.0-alpha
IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(IMAGE_VERSION)
IMAGE_TAG_LATEST=$(REGISTRY_NAME)/$(IMAGE_NAME):latest
REV=$(shell git describe --long --tags --dirty)
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-gofmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ diff=$(find . -name "*.go" | grep -v "\/vendor\/" | xargs gofmt -s -d 2>&1)
if [[ -n "${diff}" ]]; then
echo "${diff}"
echo
echo "Please run hack/update-gofmt to fix the issue(s)"
echo "Please run hack/update-gofmt.sh to fix the issue(s)"
exit 1
fi
echo "No issue found"
4 changes: 2 additions & 2 deletions pkg/azurefile/azurefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
"k8s.io/kubernetes/pkg/util/mount"

"github.com/andyzhangx/azurefile-csi-driver/pkg/csi-common"
"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
)

const (
driverName = "file.csi.azure.com"
vendorVersion = "v0.1.0-alpha"
vendorVersion = "v0.2.0-alpha"
seperator = "#"
volumeIDTemplate = "%s#%s#%s"
fileMode = "file_mode"
Expand Down
8 changes: 4 additions & 4 deletions pkg/azurefile/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"k8s.io/kubernetes/pkg/volume/util"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage"
"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"github.com/pborman/uuid"

Expand Down Expand Up @@ -103,9 +103,9 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)

return &csi.CreateVolumeResponse{
Volume: &csi.Volume{
Id: volumeID,
VolumeId: volumeID,
CapacityBytes: req.GetCapacityRange().GetRequiredBytes(),
Attributes: parameters,
VolumeContext: parameters,
},
}, nil
}
Expand Down Expand Up @@ -156,7 +156,7 @@ func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.Valida
// todo: we may check file share existence here

// azure file supports all AccessModes, no need to check capabilities here
return &csi.ValidateVolumeCapabilitiesResponse{Supported: true, Message: ""}, nil
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil
}

// ControllerGetCapabilities returns the capabilities of the Controller plugin
Expand Down
2 changes: 1 addition & 1 deletion pkg/azurefile/identityserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
)

Expand Down
22 changes: 9 additions & 13 deletions pkg/azurefile/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"runtime"
"strings"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -70,15 +70,15 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu

readOnly := req.GetReadonly()
volumeID := req.GetVolumeId()
attrib := req.GetVolumeAttributes()
attrib := req.GetVolumeContext()
mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()

glog.V(2).Infof("target %v\nfstype %v\n\nreadonly %v\nvolumeId %v\nattributes %v\nmountflags %v\n",
glog.V(2).Infof("target %v\nfstype %v\n\nreadonly %v\nvolumeId %v\ncontext %v\nmountflags %v\n",
targetPath, fsType, readOnly, volumeID, attrib, mountFlags)

var accountName, accountKey, fileShareName string

secrets := req.GetNodePublishSecrets()
secrets := req.GetSecrets()
if len(secrets) == 0 {
var resourceGroupName string
resourceGroupName, accountName, fileShareName, err = getFileShareInfo(volumeID)
Expand Down Expand Up @@ -223,15 +223,6 @@ func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabi
}, nil
}

// NodeGetId return a unique ID of the node on which this plugin is running
func (d *Driver) NodeGetId(ctx context.Context, req *csi.NodeGetIdRequest) (*csi.NodeGetIdResponse, error) {
glog.V(5).Infof("Using default NodeGetId")

return &csi.NodeGetIdResponse{
NodeId: d.NodeID,
}, nil
}

// NodeGetInfo return info of the node on which this plugin is running
func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
glog.V(5).Infof("Using default NodeGetInfo")
Expand All @@ -240,3 +231,8 @@ func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (
NodeId: d.NodeID,
}, nil
}

// NodeGetVolumeStats get volume stats
func (d *Driver) NodeGetVolumeStats(ctx context.Context, in *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
return nil, status.Error(codes.Unimplemented, "")
}
9 changes: 3 additions & 6 deletions pkg/csi-common/controllerserver-default.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package csicommon

import (
"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -56,16 +56,13 @@ func (cs *DefaultControllerServer) ValidateVolumeCapabilities(ctx context.Contex
}
if !found {
return &csi.ValidateVolumeCapabilitiesResponse{
Supported: false,
Message: "Driver doesnot support mode:" + c.GetAccessMode().GetMode().String(),
Message: "Driver doesnot support mode:" + c.GetAccessMode().GetMode().String(),
}, status.Error(codes.InvalidArgument, "Driver doesnot support mode:"+c.GetAccessMode().GetMode().String())
}
// TODO: Ignoring mount & block tyeps for now.
}

return &csi.ValidateVolumeCapabilitiesResponse{
Supported: true,
}, nil
return &csi.ValidateVolumeCapabilitiesResponse{}, nil
}

func (cs *DefaultControllerServer) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package csicommon

import (
"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"

"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package csicommon
import (
"testing"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/identityserver-default.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package csicommon

import (
"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/identityserver-default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"testing"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/stretchr/testify/assert"
)

Expand Down
10 changes: 1 addition & 9 deletions pkg/csi-common/nodeserver-default.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package csicommon

import (
"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"golang.org/x/net/context"
)
Expand All @@ -26,14 +26,6 @@ type DefaultNodeServer struct {
Driver *CSIDriver
}

func (ns *DefaultNodeServer) NodeGetId(ctx context.Context, req *csi.NodeGetIdRequest) (*csi.NodeGetIdResponse, error) {
glog.V(5).Infof("Using default NodeGetId")

return &csi.NodeGetIdResponse{
NodeId: ns.Driver.NodeID,
}, nil
}

func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
glog.V(5).Infof("Using default NodeGetInfo")

Expand Down
14 changes: 1 addition & 13 deletions pkg/csi-common/nodeserver-default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,10 @@ import (
"context"
"testing"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/stretchr/testify/assert"
)

func TestNodeGetId(t *testing.T) {
d := NewFakeDriver()

ns := NewDefaultNodeServer(d)

// Test valid request
req := csi.NodeGetIdRequest{}
resp, err := ns.NodeGetId(context.Background(), &req)
assert.NoError(t, err)
assert.Equal(t, resp.GetNodeId(), fakeNodeID)
}

func TestNodeGetInfo(t *testing.T) {
d := NewFakeDriver()

Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/golang/glog"
"google.golang.org/grpc"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
)

// Defines Non blocking GRPC server interfaces
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"strings"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/github.com/container-storage-interface/spec/OWNERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/container-storage-interface/spec/VERSION

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading