Skip to content

Commit 8440d50

Browse files
committed
Updated to CSI v1.10.0, and added the SnapshotMetadata server.
1 parent 56ba74f commit 8440d50

File tree

18 files changed

+9214
-4988
lines changed

18 files changed

+9214
-4988
lines changed

driver/driver-controller.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ import (
2929

3030
// CSIDriverControllerServer is the Controller service component of the driver.
3131
type CSIDriverControllerServer struct {
32-
Controller csi.ControllerServer
33-
Identity csi.IdentityServer
32+
Controller csi.ControllerServer
33+
Identity csi.IdentityServer
34+
SnapshotMetadata csi.SnapshotMetadataServer
3435
}
3536

3637
// CSIDriverController is the CSI Driver Controller backend.
@@ -76,6 +77,9 @@ func (c *CSIDriverController) Start(l net.Listener) error {
7677
if c.controllerServer.Identity != nil {
7778
csi.RegisterIdentityServer(c.server, c.controllerServer.Identity)
7879
}
80+
if c.controllerServer.SnapshotMetadata != nil {
81+
csi.RegisterSnapshotMetadataServer(c.server, c.controllerServer.SnapshotMetadata)
82+
}
7983

8084
reflection.Register(c.server)
8185

driver/driver.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
//go:generate mockgen -package=driver -destination=driver.mock.go github.com/container-storage-interface/spec/lib/go/csi IdentityServer,ControllerServer,NodeServer
17+
//go:generate mockgen -package=driver -destination=driver.mock.go github.com/container-storage-interface/spec/lib/go/csi IdentityServer,ControllerServer,NodeServer,SnapshotMetadataServer
1818

1919
package driver
2020

@@ -47,9 +47,10 @@ var (
4747
// CSIDriverServers is a unified driver component with both Controller and Node
4848
// services.
4949
type CSIDriverServers struct {
50-
Controller csi.ControllerServer
51-
Identity csi.IdentityServer
52-
Node csi.NodeServer
50+
Controller csi.ControllerServer
51+
Identity csi.IdentityServer
52+
Node csi.NodeServer
53+
SnapshotMetadata csi.SnapshotMetadataServer
5354
}
5455

5556
// This is the key name in all the CSI secret objects.
@@ -116,6 +117,10 @@ func (c *CSIDriver) Start(l net.Listener) error {
116117
if c.servers.Node != nil {
117118
csi.RegisterNodeServer(c.server, c.servers.Node)
118119
}
120+
if c.servers.SnapshotMetadata != nil {
121+
csi.RegisterSnapshotMetadataServer(c.server, c.servers.SnapshotMetadata)
122+
}
123+
119124
reflection.Register(c.server)
120125

121126
// Start listening for requests

driver/driver.mock.go

+100-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

driver/mock.go

+23-7
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ package driver
1919
import (
2020
"net"
2121

22-
"github.com/kubernetes-csi/csi-test/v5/utils"
22+
"github.com/container-storage-interface/spec/lib/go/csi"
2323
"google.golang.org/grpc"
24+
25+
"github.com/kubernetes-csi/csi-test/v5/utils"
2426
)
2527

2628
type MockCSIDriverServers struct {
27-
Controller *MockControllerServer
28-
Identity *MockIdentityServer
29-
Node *MockNodeServer
29+
Controller *MockControllerServer
30+
Identity *MockIdentityServer
31+
Node *MockNodeServer
32+
SnapshotMetadata *MockSnapshotMetadataServer
3033
}
3134

3235
type MockCSIDriver struct {
@@ -38,9 +41,22 @@ func NewMockCSIDriver(servers *MockCSIDriverServers) *MockCSIDriver {
3841
return &MockCSIDriver{
3942
CSIDriver: CSIDriver{
4043
servers: &CSIDriverServers{
41-
Controller: servers.Controller,
42-
Node: servers.Node,
43-
Identity: servers.Identity,
44+
Controller: struct {
45+
csi.UnsafeControllerServer
46+
*MockControllerServer
47+
}{MockControllerServer: servers.Controller},
48+
Node: struct {
49+
csi.UnsafeNodeServer
50+
*MockNodeServer
51+
}{MockNodeServer: servers.Node},
52+
Identity: struct {
53+
csi.UnsafeIdentityServer
54+
*MockIdentityServer
55+
}{MockIdentityServer: servers.Identity},
56+
SnapshotMetadata: struct {
57+
csi.UnsafeSnapshotMetadataServer
58+
*MockSnapshotMetadataServer
59+
}{MockSnapshotMetadataServer: servers.SnapshotMetadata},
4460
},
4561
},
4662
}

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/kubernetes-csi/csi-test/v5
33
go 1.18
44

55
require (
6-
github.com/container-storage-interface/spec v1.9.0
6+
github.com/container-storage-interface/spec v1.10.0
77
github.com/golang/mock v1.6.0
88
github.com/golang/protobuf v1.5.4
99
github.com/google/uuid v1.6.0
@@ -19,7 +19,7 @@ require (
1919
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
2020
github.com/google/go-cmp v0.6.0 // indirect
2121
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
22-
golang.org/x/net v0.22.0 // indirect
22+
golang.org/x/net v0.23.0 // indirect
2323
golang.org/x/sys v0.18.0 // indirect
2424
golang.org/x/text v0.14.0 // indirect
2525
golang.org/x/tools v0.14.0 // indirect

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
22
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
33
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
4-
github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY=
5-
github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0=
4+
github.com/container-storage-interface/spec v1.10.0 h1:YkzWPV39x+ZMTa6Ax2czJLLwpryrQ+dPesB34mrRMXA=
5+
github.com/container-storage-interface/spec v1.10.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI=
66
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
77
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
88
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -38,8 +38,8 @@ golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
3838
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
3939
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
4040
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
41-
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
42-
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
41+
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
42+
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
4343
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
4444
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
4545
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

test/driver_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
// This example assumes that your driver will create the server and listen on
3232
// some unix domain socket or port for tests.
3333
type simpleDriver struct {
34+
csi.UnimplementedIdentityServer
3435
listener net.Listener
3536
server *grpc.Server
3637
wg sync.WaitGroup

0 commit comments

Comments
 (0)