Skip to content

Commit

Permalink
Merge pull request #545 from carlbraganza/csi-1.10-snapshot-metadata
Browse files Browse the repository at this point in the history
Updated to CSI v1.10.0 and add support for the SnapshotMetadata service.
  • Loading branch information
k8s-ci-robot committed Jul 16, 2024
2 parents 56ba74f + 8440d50 commit 7a77a22
Show file tree
Hide file tree
Showing 18 changed files with 9,214 additions and 4,988 deletions.
8 changes: 6 additions & 2 deletions driver/driver-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import (

// CSIDriverControllerServer is the Controller service component of the driver.
type CSIDriverControllerServer struct {
Controller csi.ControllerServer
Identity csi.IdentityServer
Controller csi.ControllerServer
Identity csi.IdentityServer
SnapshotMetadata csi.SnapshotMetadataServer
}

// CSIDriverController is the CSI Driver Controller backend.
Expand Down Expand Up @@ -76,6 +77,9 @@ func (c *CSIDriverController) Start(l net.Listener) error {
if c.controllerServer.Identity != nil {
csi.RegisterIdentityServer(c.server, c.controllerServer.Identity)
}
if c.controllerServer.SnapshotMetadata != nil {
csi.RegisterSnapshotMetadataServer(c.server, c.controllerServer.SnapshotMetadata)
}

reflection.Register(c.server)

Expand Down
13 changes: 9 additions & 4 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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

package driver

Expand Down Expand Up @@ -47,9 +47,10 @@ var (
// CSIDriverServers is a unified driver component with both Controller and Node
// services.
type CSIDriverServers struct {
Controller csi.ControllerServer
Identity csi.IdentityServer
Node csi.NodeServer
Controller csi.ControllerServer
Identity csi.IdentityServer
Node csi.NodeServer
SnapshotMetadata csi.SnapshotMetadataServer
}

// This is the key name in all the CSI secret objects.
Expand Down Expand Up @@ -116,6 +117,10 @@ func (c *CSIDriver) Start(l net.Listener) error {
if c.servers.Node != nil {
csi.RegisterNodeServer(c.server, c.servers.Node)
}
if c.servers.SnapshotMetadata != nil {
csi.RegisterSnapshotMetadataServer(c.server, c.servers.SnapshotMetadata)
}

reflection.Register(c.server)

// Start listening for requests
Expand Down
101 changes: 100 additions & 1 deletion driver/driver.mock.go

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

30 changes: 23 additions & 7 deletions driver/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ package driver
import (
"net"

"github.com/kubernetes-csi/csi-test/v5/utils"
"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc"

"github.com/kubernetes-csi/csi-test/v5/utils"
)

type MockCSIDriverServers struct {
Controller *MockControllerServer
Identity *MockIdentityServer
Node *MockNodeServer
Controller *MockControllerServer
Identity *MockIdentityServer
Node *MockNodeServer
SnapshotMetadata *MockSnapshotMetadataServer
}

type MockCSIDriver struct {
Expand All @@ -38,9 +41,22 @@ func NewMockCSIDriver(servers *MockCSIDriverServers) *MockCSIDriver {
return &MockCSIDriver{
CSIDriver: CSIDriver{
servers: &CSIDriverServers{
Controller: servers.Controller,
Node: servers.Node,
Identity: servers.Identity,
Controller: struct {
csi.UnsafeControllerServer
*MockControllerServer
}{MockControllerServer: servers.Controller},
Node: struct {
csi.UnsafeNodeServer
*MockNodeServer
}{MockNodeServer: servers.Node},
Identity: struct {
csi.UnsafeIdentityServer
*MockIdentityServer
}{MockIdentityServer: servers.Identity},
SnapshotMetadata: struct {
csi.UnsafeSnapshotMetadataServer
*MockSnapshotMetadataServer
}{MockSnapshotMetadataServer: servers.SnapshotMetadata},
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kubernetes-csi/csi-test/v5
go 1.18

require (
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 All @@ -19,7 +19,7 @@ require (
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.14.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -38,8 +38,8 @@ golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
1 change: 1 addition & 0 deletions test/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
// This example assumes that your driver will create the server and listen on
// some unix domain socket or port for tests.
type simpleDriver struct {
csi.UnimplementedIdentityServer
listener net.Listener
server *grpc.Server
wg sync.WaitGroup
Expand Down
Loading

0 comments on commit 7a77a22

Please sign in to comment.