Skip to content

Commit 0de3d92

Browse files
authored
Merge pull request #1710 from andyzhangx/upgrade-csi-spec
chore: update CSI spec to v1.10.0
2 parents 799fdb9 + d002b8f commit 0de3d92

File tree

10 files changed

+8484
-4472
lines changed

10 files changed

+8484
-4472
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.0
1414
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
1515
github.com/Azure/go-autorest/autorest v0.11.29
16-
github.com/container-storage-interface/spec v1.9.0
16+
github.com/container-storage-interface/spec v1.10.0
1717
github.com/go-ini/ini v1.67.0
1818
github.com/golang/protobuf v1.5.4
1919
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK3
8484
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
8585
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
8686
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
87-
github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY=
88-
github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0=
87+
github.com/container-storage-interface/spec v1.10.0 h1:YkzWPV39x+ZMTa6Ax2czJLLwpryrQ+dPesB34mrRMXA=
88+
github.com/container-storage-interface/spec v1.10.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI=
8989
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
9090
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
9191
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=

pkg/blob/blob.go

+5
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ func (option *DriverOptions) AddFlags() {
213213
// Driver implements all interfaces of CSI drivers
214214
type Driver struct {
215215
csicommon.CSIDriver
216+
// Embed UnimplementedXXXServer to ensure the driver returns Unimplemented for any
217+
// new RPC methods that might be introduced in future versions of the spec.
218+
csi.UnimplementedControllerServer
219+
csi.UnimplementedIdentityServer
220+
csi.UnimplementedNodeServer
216221

217222
cloud *azure.Cloud
218223
clientFactory azclient.ClientFactory

pkg/blob/identityserver_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func TestProbe(t *testing.T) {
5656
resp, err := d.Probe(context.Background(), &req)
5757
assert.NoError(t, err)
5858
assert.NotNil(t, resp)
59-
assert.Equal(t, resp.XXX_sizecache, int32(0))
6059
assert.Equal(t, resp.Ready.Value, true)
6160
}
6261

@@ -66,5 +65,4 @@ func TestGetPluginCapabilities(t *testing.T) {
6665
resp, err := d.GetPluginCapabilities(context.Background(), &req)
6766
assert.NoError(t, err)
6867
assert.NotNil(t, resp)
69-
assert.Equal(t, resp.XXX_sizecache, int32(0))
7068
}

pkg/blob/nodeserver.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,9 @@ func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeSta
552552
return nil, status.Errorf(codes.Internal, "%v", err)
553553
}
554554
if cache != nil {
555-
resp := cache.(csi.NodeGetVolumeStatsResponse)
555+
resp := cache.(*csi.NodeGetVolumeStatsResponse)
556556
klog.V(6).Infof("NodeGetVolumeStats: volume stats for volume %s path %s is cached", req.VolumeId, req.VolumePath)
557-
return &resp, nil
557+
return resp, nil
558558
}
559559

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

pkg/blob/nodeserver_test.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -161,37 +161,37 @@ func TestNodePublishVolume(t *testing.T) {
161161
tests := []struct {
162162
desc string
163163
setup func(*Driver)
164-
req csi.NodePublishVolumeRequest
164+
req *csi.NodePublishVolumeRequest
165165
expectedErr error
166166
cleanup func(*Driver)
167167
}{
168168
{
169169
desc: "Volume capabilities missing",
170-
req: csi.NodePublishVolumeRequest{},
170+
req: &csi.NodePublishVolumeRequest{},
171171
expectedErr: status.Error(codes.InvalidArgument, "Volume capability missing in request"),
172172
},
173173
{
174174
desc: "Volume ID missing",
175-
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap}},
175+
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap}},
176176
expectedErr: status.Error(codes.InvalidArgument, "Volume ID missing in request"),
177177
},
178178
{
179179
desc: "Stage path missing",
180-
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
180+
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
181181
VolumeId: "vol_1",
182182
TargetPath: sourceTest},
183183
expectedErr: status.Error(codes.InvalidArgument, "Staging target not provided"),
184184
},
185185
{
186186
desc: "Stage target path missing",
187-
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
187+
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
188188
VolumeId: "vol_1",
189189
StagingTargetPath: sourceTest},
190190
expectedErr: status.Error(codes.InvalidArgument, "Target path not provided"),
191191
},
192192
{
193193
desc: "Valid request read only",
194-
req: csi.NodePublishVolumeRequest{
194+
req: &csi.NodePublishVolumeRequest{
195195
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
196196
VolumeId: "vol_1",
197197
TargetPath: targetTest,
@@ -205,7 +205,7 @@ func TestNodePublishVolume(t *testing.T) {
205205
},
206206
{
207207
desc: "Error creating directory",
208-
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
208+
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
209209
VolumeId: "vol_1",
210210
TargetPath: "./azure.go",
211211
StagingTargetPath: sourceTest,
@@ -214,7 +214,7 @@ func TestNodePublishVolume(t *testing.T) {
214214
},
215215
{
216216
desc: "Error mounting resource busy",
217-
req: csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
217+
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
218218
VolumeId: "vol_1",
219219
TargetPath: targetTest,
220220
StagingTargetPath: sourceTest,
@@ -223,7 +223,7 @@ func TestNodePublishVolume(t *testing.T) {
223223
},
224224
{
225225
desc: "[Error] invalid mountPermissions",
226-
req: csi.NodePublishVolumeRequest{
226+
req: &csi.NodePublishVolumeRequest{
227227
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
228228
VolumeId: "vol_1",
229229
TargetPath: targetTest,
@@ -253,7 +253,7 @@ func TestNodePublishVolume(t *testing.T) {
253253
if test.setup != nil {
254254
test.setup(d)
255255
}
256-
_, err := d.NodePublishVolume(context.Background(), &test.req)
256+
_, err := d.NodePublishVolume(context.Background(), test.req)
257257

258258
if !reflect.DeepEqual(err, test.expectedErr) {
259259
t.Errorf("Desc: %s - Unexpected error: %v - Expected: %v", test.desc, err, test.expectedErr)
@@ -323,23 +323,23 @@ func TestNodeUnpublishVolume(t *testing.T) {
323323
tests := []struct {
324324
desc string
325325
setup func(*Driver)
326-
req csi.NodeUnpublishVolumeRequest
326+
req *csi.NodeUnpublishVolumeRequest
327327
expectedErr error
328328
cleanup func(*Driver)
329329
}{
330330
{
331331
desc: "Volume ID missing",
332-
req: csi.NodeUnpublishVolumeRequest{TargetPath: targetTest},
332+
req: &csi.NodeUnpublishVolumeRequest{TargetPath: targetTest},
333333
expectedErr: status.Error(codes.InvalidArgument, "Volume ID missing in request"),
334334
},
335335
{
336336
desc: "Target missing",
337-
req: csi.NodeUnpublishVolumeRequest{VolumeId: "vol_1"},
337+
req: &csi.NodeUnpublishVolumeRequest{VolumeId: "vol_1"},
338338
expectedErr: status.Error(codes.InvalidArgument, "Target path missing in request"),
339339
},
340340
{
341341
desc: "Valid request",
342-
req: csi.NodeUnpublishVolumeRequest{TargetPath: "./abc.go", VolumeId: "vol_1"},
342+
req: &csi.NodeUnpublishVolumeRequest{TargetPath: "./abc.go", VolumeId: "vol_1"},
343343
expectedErr: nil,
344344
},
345345
}
@@ -360,7 +360,7 @@ func TestNodeUnpublishVolume(t *testing.T) {
360360
if test.setup != nil {
361361
test.setup(d)
362362
}
363-
_, err := d.NodeUnpublishVolume(context.Background(), &test.req)
363+
_, err := d.NodeUnpublishVolume(context.Background(), test.req)
364364

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

707707
tests := []struct {
708708
desc string
709-
req csi.NodeGetVolumeStatsRequest
709+
req *csi.NodeGetVolumeStatsRequest
710710
expectedErr error
711711
}{
712712
{
713713
desc: "[Error] Volume ID missing",
714-
req: csi.NodeGetVolumeStatsRequest{VolumePath: targetTest},
714+
req: &csi.NodeGetVolumeStatsRequest{VolumePath: targetTest},
715715
expectedErr: status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume ID was empty"),
716716
},
717717
{
718718
desc: "[Error] VolumePath missing",
719-
req: csi.NodeGetVolumeStatsRequest{VolumeId: "vol_1"},
719+
req: &csi.NodeGetVolumeStatsRequest{VolumeId: "vol_1"},
720720
expectedErr: status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume path was empty"),
721721
},
722722
{
723723
desc: "[Error] Incorrect volume path",
724-
req: csi.NodeGetVolumeStatsRequest{VolumePath: nonexistedPath, VolumeId: "vol_1"},
724+
req: &csi.NodeGetVolumeStatsRequest{VolumePath: nonexistedPath, VolumeId: "vol_1"},
725725
expectedErr: status.Errorf(codes.NotFound, "path /not/a/real/directory does not exist"),
726726
},
727727
{
728728
desc: "[Success] Standard success",
729-
req: csi.NodeGetVolumeStatsRequest{VolumePath: fakePath, VolumeId: "vol_1"},
729+
req: &csi.NodeGetVolumeStatsRequest{VolumePath: fakePath, VolumeId: "vol_1"},
730730
expectedErr: nil,
731731
},
732732
}
@@ -736,7 +736,7 @@ func TestNodeGetVolumeStats(t *testing.T) {
736736
d := NewFakeDriver()
737737

738738
for _, test := range tests {
739-
_, err := d.NodeGetVolumeStats(context.Background(), &test.req)
739+
_, err := d.NodeGetVolumeStats(context.Background(), test.req)
740740
//t.Errorf("[debug] error: %v\n metrics: %v", err, metrics)
741741
if !reflect.DeepEqual(err, test.expectedErr) {
742742
t.Errorf("desc: %v, expected error: %v, actual error: %v", test.desc, test.expectedErr, err)

pkg/csi-common/utils_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ func TestLogGRPC(t *testing.T) {
108108
"account_name": "k8s",
109109
"account_key": "testkey",
110110
},
111-
XXX_sizecache: 100,
112111
},
113112
`GRPC request: {"secrets":"***stripped***","volume_id":"vol_1"}`,
114113
},
@@ -126,7 +125,6 @@ func TestLogGRPC(t *testing.T) {
126125
"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
127126
"csi.storage.k8s.io/testfield": "testvalue",
128127
},
129-
XXX_sizecache: 100,
130128
},
131129
`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
132130
},
@@ -137,7 +135,6 @@ func TestLogGRPC(t *testing.T) {
137135
"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
138136
"csi.storage.k8s.io/testfield": "testvalue",
139137
},
140-
XXX_sizecache: 100,
141138
},
142139
`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
143140
},
@@ -153,7 +150,6 @@ func TestLogGRPC(t *testing.T) {
153150
"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
154151
"csi.storage.k8s.io/testfield": "testvalue",
155152
},
156-
XXX_sizecache: 100,
157153
},
158154
`GRPC request: {"secrets":"***stripped***","volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"},"volume_id":"vol_1"}`,
159155
},
@@ -202,7 +198,6 @@ func TestNewControllerServiceCapability(t *testing.T) {
202198
for _, test := range tests {
203199
resp := NewControllerServiceCapability(test.cap)
204200
assert.NotNil(t, resp)
205-
assert.Equal(t, resp.XXX_sizecache, int32(0))
206201
}
207202
}
208203

@@ -226,7 +221,6 @@ func TestNewNodeServiceCapability(t *testing.T) {
226221
for _, test := range tests {
227222
resp := NewNodeServiceCapability(test.cap)
228223
assert.NotNil(t, resp)
229-
assert.Equal(t, resp.XXX_sizecache, int32(0))
230224
}
231225
}
232226

0 commit comments

Comments
 (0)