Skip to content

Commit

Permalink
Merge pull request #2211 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2209-to-release-1.31

[release-1.31] chore: update CSI spec to v1.10.0
  • Loading branch information
k8s-ci-robot authored Nov 22, 2024
2 parents 366da38 + 16ba244 commit a2fbe33
Show file tree
Hide file tree
Showing 12 changed files with 8,542 additions and 4,557 deletions.
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-storage-file-go v0.8.0
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/container-storage-interface/spec v1.9.0
github.com/container-storage-interface/spec v1.10.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/uuid v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
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.1-0.20231103132048-7d375ecc2b09 h1:OoRAFlvDGCUqDLampLQjk0yeeSGdF9zzst/3G9IkBbc=
Expand Down
6 changes: 6 additions & 0 deletions pkg/azurefile/azurefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ var (
// 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
cloudConfigSecretName string
cloudConfigSecretNamespace string
Expand Down
30 changes: 8 additions & 22 deletions pkg/azurefile/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,14 @@ const (
)

var (
volumeCaps = []csi.VolumeCapability_AccessMode{
{
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
},
{
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY,
},
{
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER,
},
{
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER,
},
{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY,
},
{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_SINGLE_WRITER,
},
{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
},
volumeCaps = []*csi.VolumeCapability_AccessMode{
{Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER},
{Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY},
{Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER},
{Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER},
{Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY},
{Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_SINGLE_WRITER},
{Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER},
}
skipMatchingTag = map[string]*string{azure.SkipMatchingTag: ptr.To("")}
)
Expand Down
34 changes: 10 additions & 24 deletions pkg/azurefile/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ var _ = ginkgo.Describe("ControllerGetCapabilities", func() {
})

var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
req csi.ValidateVolumeCapabilitiesRequest,
req *csi.ValidateVolumeCapabilitiesRequest,
expectedErr error,
mockedFileShareErr error,
) {
Expand Down Expand Up @@ -1741,25 +1741,25 @@ var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
mockStorageAccountsClient.EXPECT().ListKeys(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(key, nil).AnyTimes()
mockFileClient.EXPECT().Get(context.Background(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&armstorage.FileShare{FileShareProperties: &armstorage.FileShareProperties{ShareQuota: &fakeShareQuota}}, mockedFileShareErr).AnyTimes()

_, err := d.ValidateVolumeCapabilities(context.Background(), &req)
_, err := d.ValidateVolumeCapabilities(context.Background(), req)
if expectedErr == nil {
gomega.Expect(err).NotTo(gomega.HaveOccurred())
} else {
gomega.Expect(err).To(gomega.Equal(expectedErr))
}
},
ginkgo.Entry("Volume ID missing",
csi.ValidateVolumeCapabilitiesRequest{},
&csi.ValidateVolumeCapabilitiesRequest{},
status.Error(codes.InvalidArgument, "Volume ID not provided"),
nil,
),
ginkgo.Entry("Volume capabilities missing",
csi.ValidateVolumeCapabilitiesRequest{VolumeId: "vol_1"},
&csi.ValidateVolumeCapabilitiesRequest{VolumeId: "vol_1"},
status.Error(codes.InvalidArgument, "Volume capabilities not provided"),
nil,
),
ginkgo.Entry("Volume ID not valid",
csi.ValidateVolumeCapabilitiesRequest{
&csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1",
VolumeCapabilities: []*csi.VolumeCapability{
{
Expand All @@ -1776,7 +1776,7 @@ var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
nil,
),
ginkgo.Entry("Check file share exists errors",
csi.ValidateVolumeCapabilitiesRequest{
&csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1#f5713de20cde511e8ba4900#fileshare#",
VolumeCapabilities: []*csi.VolumeCapability{
{
Expand All @@ -1793,7 +1793,7 @@ var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
fmt.Errorf("test error"),
),
ginkgo.Entry("Valid request disk name is empty",
csi.ValidateVolumeCapabilitiesRequest{
&csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1#f5713de20cde511e8ba4900#fileshare#",
VolumeCapabilities: []*csi.VolumeCapability{
{
Expand All @@ -1810,7 +1810,7 @@ var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
nil,
),
ginkgo.Entry("Valid request volume capability is multi node single writer",
csi.ValidateVolumeCapabilitiesRequest{
&csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1#f5713de20cde511e8ba4900#fileshare#diskname.vhd#",
VolumeCapabilities: []*csi.VolumeCapability{
{
Expand All @@ -1827,7 +1827,7 @@ var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
nil,
),
ginkgo.Entry("Valid request",
csi.ValidateVolumeCapabilitiesRequest{
&csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1#f5713de20cde511e8ba4900#fileshare#diskname.vhd#",
VolumeCapabilities: []*csi.VolumeCapability{
{
Expand All @@ -1844,7 +1844,7 @@ var _ = ginkgo.DescribeTable("ValidateVolumeCapabilities", func(
nil,
),
ginkgo.Entry("Resource group empty",
csi.ValidateVolumeCapabilitiesRequest{
&csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1#f5713de20cde511e8ba4900#fileshare#diskname.vhd#",
VolumeCapabilities: []*csi.VolumeCapability{
{
Expand Down Expand Up @@ -2012,20 +2012,6 @@ var _ = ginkgo.Describe("TestControllerExpandVolume", func() {
gomega.Expect(err).To(gomega.Equal(expectedErr))
})
})
ginkgo.When("Volume capabilities missing", func() {
ginkgo.It("should fail", func(ctx context.Context) {
req := &csi.ControllerExpandVolumeRequest{
VolumeId: "vol_1",
CapacityRange: stdCapRange,
}

d.Cap = []*csi.ControllerServiceCapability{}

expectedErr := status.Errorf(codes.InvalidArgument, "invalid expand volume request: volume_id:\"vol_1\" capacity_range:<required_bytes:5368709120 > ")
_, err := d.ControllerExpandVolume(ctx, req)
gomega.Expect(err).To(gomega.Equal(expectedErr))
})
})
ginkgo.When("Invalid Volume ID", func() {
ginkgo.It("should fail", func(ctx context.Context) {
req := &csi.ControllerExpandVolumeRequest{
Expand Down
2 changes: 0 additions & 2 deletions pkg/azurefile/identityserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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 @@ -65,5 +64,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))
}
12 changes: 6 additions & 6 deletions pkg/azurefile/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,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
}

// fileShareName in volumeID may contain subPath, e.g. csi-shared-config/ASCP01/certs
Expand All @@ -600,9 +600,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
}

if _, err := os.Lstat(req.VolumePath); err != nil {
Expand Down Expand Up @@ -633,9 +633,9 @@ func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeSta
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)
if newVolID != "" {
d.volStatsCache.Set(newVolID, *resp)
d.volStatsCache.Set(newVolID, resp)
}
}
isOperationSucceeded = true
Expand Down
Loading

0 comments on commit a2fbe33

Please sign in to comment.