Skip to content

Commit

Permalink
Merge pull request #1262 from jsafrane/bump-spec-1.10
Browse files Browse the repository at this point in the history
Bump CSI spec 1.10
  • Loading branch information
k8s-ci-robot authored Sep 24, 2024
2 parents 46212fd + d794397 commit 0f8b166
Show file tree
Hide file tree
Showing 24 changed files with 11,001 additions and 4,553 deletions.
2 changes: 1 addition & 1 deletion cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func main() {
if err != nil {
klog.Fatalf("Failed to get node info from CSI driver: %v", err)
}
nodeDeployment.NodeInfo = *nodeInfo
nodeDeployment.NodeInfo = nodeInfo
}

var nodeLister listersv1.NodeLister
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/kubernetes-csi/external-provisioner/v5
go 1.22.5

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/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.19.0
github.com/kubernetes-csi/csi-test/v5 v5.2.0
github.com/kubernetes-csi/csi-test/v5 v5.3.1
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0
github.com/miekg/dns v1.1.62 // indirect
github.com/prometheus/client_golang v1.19.1
Expand All @@ -31,6 +31,7 @@ require (
)

require (
github.com/google/go-cmp v0.6.0
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/gomega v1.34.1
k8s.io/kubernetes v1.31.0
Expand Down Expand Up @@ -65,7 +66,6 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.20.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,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 Expand Up @@ -113,8 +113,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubernetes-csi/csi-lib-utils v0.19.0 h1:3sT8mL9+St2acyrEtuR7CQ5L78GR4lgsb+sfon9tGfA=
github.com/kubernetes-csi/csi-lib-utils v0.19.0/go.mod h1:lBuMKvoyd8c3EG+itmnVWApLDHnLkU7ibxxZSPuOw0M=
github.com/kubernetes-csi/csi-test/v5 v5.2.0 h1:Z+sdARWC6VrONrxB24clCLCmnqCnZF7dzXtzx8eM35o=
github.com/kubernetes-csi/csi-test/v5 v5.2.0/go.mod h1:o/c5w+NU3RUNE+DbVRhEUTmkQVBGk+tFOB2yPXT8teo=
github.com/kubernetes-csi/csi-test/v5 v5.3.1 h1:Wiukp1In+kif+BFo6q2ExjgB+MbrAz4jZWzGfijypuY=
github.com/kubernetes-csi/csi-test/v5 v5.3.1/go.mod h1:7hA2cSYJ6T8CraEZPA6zqkLZwemjBD54XAnPsPC3VpA=
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0 h1:qS4r4ljINLWKJ9m9Ge3Q3sGZ/eIoDVDT2RhAdQFHb1k=
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.3.0/go.mod h1:oGXx2XTEzs9ikW2V6IC1dD8trgjRsS/Mvc2JRiC618Y=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ type NodeDeployment struct {
ClaimInformer coreinformers.PersistentVolumeClaimInformer
// NodeInfo is the result of NodeGetInfo. It is need to determine which
// PVs were created for the node.
NodeInfo csi.NodeGetInfoResponse
NodeInfo *csi.NodeGetInfoResponse
// ImmediateBinding enables support for PVCs with immediate binding.
ImmediateBinding bool
// BaseDelay is the initial time that the external-provisioner waits
Expand Down Expand Up @@ -850,7 +850,7 @@ func (p *csiProvisioner) Provision(ctx context.Context, options controller.Provi
}

if rep.Volume != nil {
klog.V(3).Infof("create volume rep: %+v", *rep.Volume)
klog.V(3).Infof("create volume rep: %+v", rep.Volume)
}
volumeAttributes := map[string]string{provisionerIDKey: p.identity}
for k, v := range rep.Volume.VolumeContext {
Expand Down
31 changes: 16 additions & 15 deletions pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/mock/gomock"
"github.com/kubernetes-csi/csi-test/v5/utils"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -170,7 +171,7 @@ func TestGetPluginName(t *testing.T) {
in := &csi.GetPluginInfoRequest{}
out := test.output[0]

identityServer.EXPECT().GetPluginInfo(gomock.Any(), in).Return(out, nil).Times(1)
identityServer.EXPECT().GetPluginInfo(gomock.Any(), utils.Protobuf(in)).Return(out, nil).Times(1)
oldName, err := GetDriverName(csiConn.conn, timeout)
if err != nil {
t.Errorf("test %q: Failed to get driver's name", test.name)
Expand All @@ -180,7 +181,7 @@ func TestGetPluginName(t *testing.T) {
}

out = test.output[1]
identityServer.EXPECT().GetPluginInfo(gomock.Any(), in).Return(out, nil).Times(1)
identityServer.EXPECT().GetPluginInfo(gomock.Any(), utils.Protobuf(in)).Return(out, nil).Times(1)
newName, err := GetDriverName(csiConn.conn, timeout)
if err != nil {
t.Errorf("test %s: Failed to get driver's name", test.name)
Expand Down Expand Up @@ -351,7 +352,7 @@ func TestGetDriverName(t *testing.T) {
}

// Setup expectation
identityServer.EXPECT().GetPluginInfo(gomock.Any(), in).Return(out, injectedErr).Times(1)
identityServer.EXPECT().GetPluginInfo(gomock.Any(), utils.Protobuf(in)).Return(out, injectedErr).Times(1)

name, err := GetDriverName(csiConn.conn, timeout)
if test.expectError && err == nil {
Expand Down Expand Up @@ -450,9 +451,9 @@ func TestCreateDriverReturnsInvalidCapacityDuringProvision(t *testing.T) {
// Set up Mocks
controllerServer.EXPECT().CreateVolume(gomock.Any(), gomock.Any()).Return(out, nil).Times(1)
// Since capacity returned by driver is invalid, we expect the provision call to clean up the volume
controllerServer.EXPECT().DeleteVolume(gomock.Any(), &csi.DeleteVolumeRequest{
controllerServer.EXPECT().DeleteVolume(gomock.Any(), utils.Protobuf(&csi.DeleteVolumeRequest{
VolumeId: "test-volume-id",
}).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)
})).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)

// Call provision
_, _, err = csiProvisioner.Provision(context.Background(), opts)
Expand Down Expand Up @@ -2279,7 +2280,7 @@ func provisionTestcases() (int64, map[string]provisioningTestcase) {
},
expectErr: true,
expectState: controller.ProvisioningNoChange,
expectNoProvision: true, // not owner yet
expectNoProvision: true, // notowner yet
expectSelectedNode: nodeFoo.Name, // changed by ShouldProvision
},
"distributed immediate, allowed topologies not okay": {
Expand Down Expand Up @@ -4558,9 +4559,9 @@ func TestProvisionFromSnapshot(t *testing.T) {
if tc.notPopulated {
out.Volume.ContentSource = nil
controllerServer.EXPECT().CreateVolume(gomock.Any(), gomock.Any()).Return(out, nil).Times(1)
controllerServer.EXPECT().DeleteVolume(gomock.Any(), &csi.DeleteVolumeRequest{
controllerServer.EXPECT().DeleteVolume(gomock.Any(), utils.Protobuf(&csi.DeleteVolumeRequest{
VolumeId: "test-volume-id",
}).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)
})).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)
} else {
snapshotSource := csi.VolumeContentSource_Snapshot{
Snapshot: &csi.VolumeContentSource_SnapshotSource{
Expand Down Expand Up @@ -5539,7 +5540,7 @@ func runDeleteTest(t *testing.T, k string, tc deleteTestcase) {
nodeDeployment = &NodeDeployment{
NodeName: tc.deploymentNode,
ClaimInformer: claimInformer,
NodeInfo: csi.NodeGetInfoResponse{
NodeInfo: &csi.NodeGetInfoResponse{
NodeId: tc.deploymentNode,
AccessibleTopology: &csi.Topology{
Segments: map[string]string{
Expand Down Expand Up @@ -6659,9 +6660,9 @@ func TestProvisionFromPVC(t *testing.T) {
controllerServer.EXPECT().CreateVolume(gomock.Any(), gomock.Any()).Return(out, nil).Times(1)
// if the volume created is less than the requested size,
// deletevolume will be called
controllerServer.EXPECT().DeleteVolume(gomock.Any(), &csi.DeleteVolumeRequest{
controllerServer.EXPECT().DeleteVolume(gomock.Any(), utils.Protobuf(&csi.DeleteVolumeRequest{
VolumeId: "test-volume-id",
}).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)
})).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)
}

_, _, _, claimLister, _, _ := listers(clientSet)
Expand Down Expand Up @@ -6838,14 +6839,14 @@ func TestProvisionWithMigration(t *testing.T) {
expectParams[translatedKey] = "foo"
}
controllerServer.EXPECT().CreateVolume(gomock.Any(),
&csi.CreateVolumeRequest{
utils.Protobuf(&csi.CreateVolumeRequest{
Name: "test-testi",
Parameters: expectParams,
VolumeCapabilities: nil,
CapacityRange: &csi.CapacityRange{
RequiredBytes: int64(requestBytes),
},
}).Return(
})).Return(
&csi.CreateVolumeResponse{
Volume: &csi.Volume{
CapacityBytes: requestBytes,
Expand Down Expand Up @@ -6997,9 +6998,9 @@ func TestDeleteMigration(t *testing.T) {
// We assert that the Delete is called on the driver with either the
// normal or the translated handle
controllerServer.EXPECT().DeleteVolume(gomock.Any(),
&csi.DeleteVolumeRequest{
utils.Protobuf(&csi.DeleteVolumeRequest{
VolumeId: volID,
}).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)
})).Return(&csi.DeleteVolumeResponse{}, nil).Times(1)

// Run Delete
err = csiProvisioner.Delete(context.Background(), tc.pv)
Expand Down
9 changes: 5 additions & 4 deletions pkg/controller/topology_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"testing"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/testing/protocmp"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/informers"
Expand Down Expand Up @@ -434,7 +435,7 @@ func TestStatefulSetSpreading(t *testing.T) {
if expected != nil && requirements.Preferred == nil {
t.Fatalf("expected preferred to be %v but requirements.Preferred is nil", expected)
}
if expected != nil && !equality.Semantic.DeepEqual(requirements.Preferred, expected) {
if expected != nil && !cmp.Equal(requirements.Preferred, expected, protocmp.Transform()) {
t.Errorf("expected preferred requisite %v; got: %v", expected, requirements.Preferred)
}
})
Expand Down Expand Up @@ -1441,7 +1442,7 @@ func TestPreferredTopologies(t *testing.T) {
if requirements == nil {
t.Fatalf("expected preferred to be %v but requirements is nil", expectedPreferred)
}
if !equality.Semantic.DeepEqual(requirements.Preferred, expectedPreferred) {
if !cmp.Equal(requirements.Preferred, expectedPreferred, protocmp.Transform()) {
t.Errorf("expected requisite %v; got: %v", tc.expectedPreferred, requirements.Preferred)
}
}
Expand Down Expand Up @@ -1603,7 +1604,7 @@ func requisiteEqual(t1, t2 []*csi.Topology) bool {
for _, topology := range t2 {
found := false
for i := range unchecked {
if equality.Semantic.DeepEqual(t1[i], topology) {
if cmp.Equal(t1[i], topology, protocmp.Transform()) {
found = true
unchecked.Delete(i)
break
Expand Down
Loading

0 comments on commit 0f8b166

Please sign in to comment.