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

chore: update CSI spec to v1.10.0 #1710

Merged
merged 2 commits into from
Nov 21, 2024
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.0
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
github.com/Azure/go-autorest/autorest v0.11.29
github.com/container-storage-interface/spec v1.9.0
github.com/container-storage-interface/spec v1.10.0
github.com/go-ini/ini v1.67.0
github.com/golang/protobuf v1.5.4
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK3
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY=
github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0=
github.com/container-storage-interface/spec v1.10.0 h1:YkzWPV39x+ZMTa6Ax2czJLLwpryrQ+dPesB34mrRMXA=
github.com/container-storage-interface/spec v1.10.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
Expand Down
5 changes: 5 additions & 0 deletions pkg/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ func (option *DriverOptions) AddFlags() {
// Driver implements all interfaces of CSI drivers
type Driver struct {
csicommon.CSIDriver
// Embed UnimplementedXXXServer to ensure the driver returns Unimplemented for any
// new RPC methods that might be introduced in future versions of the spec.
csi.UnimplementedControllerServer
csi.UnimplementedIdentityServer
csi.UnimplementedNodeServer

cloud *azure.Cloud
clientFactory azclient.ClientFactory
Expand Down
2 changes: 0 additions & 2 deletions pkg/blob/identityserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func TestProbe(t *testing.T) {
resp, err := d.Probe(context.Background(), &req)
assert.NoError(t, err)
assert.NotNil(t, resp)
assert.Equal(t, resp.XXX_sizecache, int32(0))
assert.Equal(t, resp.Ready.Value, true)
}

Expand All @@ -66,5 +65,4 @@ func TestGetPluginCapabilities(t *testing.T) {
resp, err := d.GetPluginCapabilities(context.Background(), &req)
assert.NoError(t, err)
assert.NotNil(t, resp)
assert.Equal(t, resp.XXX_sizecache, int32(0))
}
6 changes: 3 additions & 3 deletions pkg/blob/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeSta
return nil, status.Errorf(codes.Internal, "%v", err)
}
if cache != nil {
resp := cache.(csi.NodeGetVolumeStatsResponse)
resp := cache.(*csi.NodeGetVolumeStatsResponse)
klog.V(6).Infof("NodeGetVolumeStats: volume stats for volume %s path %s is cached", req.VolumeId, req.VolumePath)
return &resp, nil
return resp, nil
}

mc := metrics.NewMetricContext(blobCSIDriverName, "node_get_volume_stats", d.cloud.ResourceGroup, "", d.Name)
Expand Down Expand Up @@ -624,7 +624,7 @@ func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeSta
isOperationSucceeded = true
klog.V(6).Infof("NodeGetVolumeStats: volume stats for volume %s path %s is %v", req.VolumeId, req.VolumePath, resp)
// cache the volume stats per volume
d.volStatsCache.Set(req.VolumeId, *resp)
d.volStatsCache.Set(req.VolumeId, resp)
return resp, nil
}

Expand Down
42 changes: 21 additions & 21 deletions pkg/blob/nodeserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,37 +161,37 @@ func TestNodePublishVolume(t *testing.T) {
tests := []struct {
desc string
setup func(*Driver)
req csi.NodePublishVolumeRequest
req *csi.NodePublishVolumeRequest
expectedErr error
cleanup func(*Driver)
}{
{
desc: "Volume capabilities missing",
req: csi.NodePublishVolumeRequest{},
req: &csi.NodePublishVolumeRequest{},
expectedErr: status.Error(codes.InvalidArgument, "Volume capability missing in request"),
},
{
desc: "Volume ID missing",
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap}},
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap}},
expectedErr: status.Error(codes.InvalidArgument, "Volume ID missing in request"),
},
{
desc: "Stage path missing",
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: sourceTest},
expectedErr: status.Error(codes.InvalidArgument, "Staging target not provided"),
},
{
desc: "Stage target path missing",
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
StagingTargetPath: sourceTest},
expectedErr: status.Error(codes.InvalidArgument, "Target path not provided"),
},
{
desc: "Valid request read only",
req: csi.NodePublishVolumeRequest{
req: &csi.NodePublishVolumeRequest{
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: targetTest,
Expand All @@ -205,7 +205,7 @@ func TestNodePublishVolume(t *testing.T) {
},
{
desc: "Error creating directory",
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: "./azure.go",
StagingTargetPath: sourceTest,
Expand All @@ -214,7 +214,7 @@ func TestNodePublishVolume(t *testing.T) {
},
{
desc: "Error mounting resource busy",
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: targetTest,
StagingTargetPath: sourceTest,
Expand All @@ -223,7 +223,7 @@ func TestNodePublishVolume(t *testing.T) {
},
{
desc: "[Error] invalid mountPermissions",
req: csi.NodePublishVolumeRequest{
req: &csi.NodePublishVolumeRequest{
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: targetTest,
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestNodePublishVolume(t *testing.T) {
if test.setup != nil {
test.setup(d)
}
_, err := d.NodePublishVolume(context.Background(), &test.req)
_, err := d.NodePublishVolume(context.Background(), test.req)

if !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("Desc: %s - Unexpected error: %v - Expected: %v", test.desc, err, test.expectedErr)
Expand Down Expand Up @@ -323,23 +323,23 @@ func TestNodeUnpublishVolume(t *testing.T) {
tests := []struct {
desc string
setup func(*Driver)
req csi.NodeUnpublishVolumeRequest
req *csi.NodeUnpublishVolumeRequest
expectedErr error
cleanup func(*Driver)
}{
{
desc: "Volume ID missing",
req: csi.NodeUnpublishVolumeRequest{TargetPath: targetTest},
req: &csi.NodeUnpublishVolumeRequest{TargetPath: targetTest},
expectedErr: status.Error(codes.InvalidArgument, "Volume ID missing in request"),
},
{
desc: "Target missing",
req: csi.NodeUnpublishVolumeRequest{VolumeId: "vol_1"},
req: &csi.NodeUnpublishVolumeRequest{VolumeId: "vol_1"},
expectedErr: status.Error(codes.InvalidArgument, "Target path missing in request"),
},
{
desc: "Valid request",
req: csi.NodeUnpublishVolumeRequest{TargetPath: "./abc.go", VolumeId: "vol_1"},
req: &csi.NodeUnpublishVolumeRequest{TargetPath: "./abc.go", VolumeId: "vol_1"},
expectedErr: nil,
},
}
Expand All @@ -360,7 +360,7 @@ func TestNodeUnpublishVolume(t *testing.T) {
if test.setup != nil {
test.setup(d)
}
_, err := d.NodeUnpublishVolume(context.Background(), &test.req)
_, err := d.NodeUnpublishVolume(context.Background(), test.req)

if !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("Unexpected error: %v", err)
Expand Down Expand Up @@ -706,27 +706,27 @@ func TestNodeGetVolumeStats(t *testing.T) {

tests := []struct {
desc string
req csi.NodeGetVolumeStatsRequest
req *csi.NodeGetVolumeStatsRequest
expectedErr error
}{
{
desc: "[Error] Volume ID missing",
req: csi.NodeGetVolumeStatsRequest{VolumePath: targetTest},
req: &csi.NodeGetVolumeStatsRequest{VolumePath: targetTest},
expectedErr: status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume ID was empty"),
},
{
desc: "[Error] VolumePath missing",
req: csi.NodeGetVolumeStatsRequest{VolumeId: "vol_1"},
req: &csi.NodeGetVolumeStatsRequest{VolumeId: "vol_1"},
expectedErr: status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume path was empty"),
},
{
desc: "[Error] Incorrect volume path",
req: csi.NodeGetVolumeStatsRequest{VolumePath: nonexistedPath, VolumeId: "vol_1"},
req: &csi.NodeGetVolumeStatsRequest{VolumePath: nonexistedPath, VolumeId: "vol_1"},
expectedErr: status.Errorf(codes.NotFound, "path /not/a/real/directory does not exist"),
},
{
desc: "[Success] Standard success",
req: csi.NodeGetVolumeStatsRequest{VolumePath: fakePath, VolumeId: "vol_1"},
req: &csi.NodeGetVolumeStatsRequest{VolumePath: fakePath, VolumeId: "vol_1"},
expectedErr: nil,
},
}
Expand All @@ -736,7 +736,7 @@ func TestNodeGetVolumeStats(t *testing.T) {
d := NewFakeDriver()

for _, test := range tests {
_, err := d.NodeGetVolumeStats(context.Background(), &test.req)
_, err := d.NodeGetVolumeStats(context.Background(), test.req)
//t.Errorf("[debug] error: %v\n metrics: %v", err, metrics)
if !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("desc: %v, expected error: %v, actual error: %v", test.desc, test.expectedErr, err)
Expand Down
6 changes: 0 additions & 6 deletions pkg/csi-common/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func TestLogGRPC(t *testing.T) {
"account_name": "k8s",
"account_key": "testkey",
},
XXX_sizecache: 100,
},
`GRPC request: {"secrets":"***stripped***","volume_id":"vol_1"}`,
},
Expand All @@ -126,7 +125,6 @@ func TestLogGRPC(t *testing.T) {
"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
"csi.storage.k8s.io/testfield": "testvalue",
},
XXX_sizecache: 100,
},
`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
},
Expand All @@ -137,7 +135,6 @@ func TestLogGRPC(t *testing.T) {
"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
"csi.storage.k8s.io/testfield": "testvalue",
},
XXX_sizecache: 100,
},
`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
},
Expand All @@ -153,7 +150,6 @@ func TestLogGRPC(t *testing.T) {
"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
"csi.storage.k8s.io/testfield": "testvalue",
},
XXX_sizecache: 100,
},
`GRPC request: {"secrets":"***stripped***","volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"},"volume_id":"vol_1"}`,
},
Expand Down Expand Up @@ -202,7 +198,6 @@ func TestNewControllerServiceCapability(t *testing.T) {
for _, test := range tests {
resp := NewControllerServiceCapability(test.cap)
assert.NotNil(t, resp)
assert.Equal(t, resp.XXX_sizecache, int32(0))
}
}

Expand All @@ -226,7 +221,6 @@ func TestNewNodeServiceCapability(t *testing.T) {
for _, test := range tests {
resp := NewNodeServiceCapability(test.cap)
assert.NotNil(t, resp)
assert.Equal(t, resp.XXX_sizecache, int32(0))
}
}

Expand Down
Loading
Loading