Skip to content

Commit 99af4f9

Browse files
authored
Merge pull request #515 from huww98/csi-next
bump CSI spec to v1.10.0
2 parents 428b523 + 19649f7 commit 99af4f9

File tree

17 files changed

+8476
-5100
lines changed

17 files changed

+8476
-5100
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/kubernetes-csi/csi-driver-host-path
33
go 1.21
44

55
require (
6-
github.com/container-storage-interface/spec v1.9.0
7-
github.com/golang/protobuf v1.5.4
6+
github.com/container-storage-interface/spec v1.10.0
87
github.com/kubernetes-csi/csi-lib-utils v0.17.0
98
github.com/pborman/uuid v1.2.1
109
github.com/stretchr/testify v1.9.0
1110
golang.org/x/net v0.26.0
1211
google.golang.org/grpc v1.64.0
12+
google.golang.org/protobuf v1.33.0
1313
k8s.io/apimachinery v0.29.0
1414
k8s.io/klog/v2 v2.130.0
1515
k8s.io/kubernetes v1.29.2
@@ -23,6 +23,7 @@ require (
2323
github.com/davecgh/go-spew v1.1.1 // indirect
2424
github.com/go-logr/logr v1.4.1 // indirect
2525
github.com/gogo/protobuf v1.3.2 // indirect
26+
github.com/golang/protobuf v1.5.4 // indirect
2627
github.com/google/uuid v1.6.0 // indirect
2728
github.com/kr/text v0.2.0 // indirect
2829
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
@@ -36,7 +37,6 @@ require (
3637
golang.org/x/sys v0.21.0 // indirect
3738
golang.org/x/text v0.16.0 // indirect
3839
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
39-
google.golang.org/protobuf v1.33.0 // indirect
4040
gopkg.in/inf.v0 v0.9.1 // indirect
4141
gopkg.in/yaml.v2 v2.4.0 // indirect
4242
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
44
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
55
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
66
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
7-
github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY=
8-
github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0=
7+
github.com/container-storage-interface/spec v1.10.0 h1:YkzWPV39x+ZMTa6Ax2czJLLwpryrQ+dPesB34mrRMXA=
8+
github.com/container-storage-interface/spec v1.10.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI=
99
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1010
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1111
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

pkg/hostpath/controllerserver.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ import (
2323
"sort"
2424
"strconv"
2525

26-
"github.com/golang/protobuf/ptypes"
27-
28-
"github.com/golang/protobuf/ptypes/wrappers"
2926
"github.com/pborman/uuid"
3027
"golang.org/x/net/context"
3128
"google.golang.org/grpc/codes"
3229
"google.golang.org/grpc/status"
30+
"google.golang.org/protobuf/types/known/timestamppb"
31+
"google.golang.org/protobuf/types/known/wrapperspb"
3332

3433
"github.com/container-storage-interface/spec/lib/go/csi"
3534
"k8s.io/apimachinery/pkg/util/sets"
@@ -397,11 +396,11 @@ func (hp *hostPath) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest
397396

398397
return &csi.GetCapacityResponse{
399398
AvailableCapacity: available,
400-
MaximumVolumeSize: &wrappers.Int64Value{Value: maxVolumeSize},
399+
MaximumVolumeSize: &wrapperspb.Int64Value{Value: maxVolumeSize},
401400

402401
// We don't have a minimum volume size, so we might as well report that.
403402
// Better explicit than implicit...
404-
MinimumVolumeSize: &wrappers.Int64Value{Value: 0},
403+
MinimumVolumeSize: &wrapperspb.Int64Value{Value: 0},
405404
}, nil
406405
}
407406

@@ -461,7 +460,7 @@ func (hp *hostPath) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest
461460
})
462461
}
463462

464-
klog.V(5).Infof("Volumes are: %+v", *volumeRes)
463+
klog.V(5).Infof("Volumes are: %+v", volumeRes)
465464
return volumeRes, nil
466465
}
467466

@@ -584,7 +583,7 @@ func (hp *hostPath) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotR
584583
}
585584

586585
snapshotID := uuid.NewUUID().String()
587-
creationTime := ptypes.TimestampNow()
586+
creationTime := timestamppb.Now()
588587
file := hp.getSnapshotPath(snapshotID)
589588

590589
if err := hp.createSnapshotFromVolume(hostPathVolume, file); err != nil {
@@ -678,15 +677,15 @@ func (hp *hostPath) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsReq
678677
return &csi.ListSnapshotsResponse{}, nil
679678
}
680679

681-
var snapshots []csi.Snapshot
680+
var snapshots []*csi.Snapshot
682681
// case 3: no parameter is set, so we return all the snapshots.
683682
hpSnapshots := hp.state.GetSnapshots()
684683
sort.Slice(hpSnapshots, func(i, j int) bool {
685684
return hpSnapshots[i].Id < hpSnapshots[j].Id
686685
})
687686

688687
for _, snap := range hpSnapshots {
689-
snapshot := csi.Snapshot{
688+
snapshot := &csi.Snapshot{
690689
SnapshotId: snap.Id,
691690
SourceVolumeId: snap.VolID,
692691
CreationTime: snap.CreationTime,
@@ -741,7 +740,7 @@ func (hp *hostPath) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsReq
741740

742741
for i = 0; i < len(entries); i++ {
743742
entries[i] = &csi.ListSnapshotsResponse_Entry{
744-
Snapshot: &snapshots[j],
743+
Snapshot: snapshots[j],
745744
}
746745
j++
747746
}

pkg/hostpath/groupcontrollerserver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"os"
2121

2222
"github.com/container-storage-interface/spec/lib/go/csi"
23-
"github.com/golang/protobuf/ptypes"
2423
"github.com/pborman/uuid"
2524
"golang.org/x/net/context"
2625
"google.golang.org/grpc/codes"
2726
"google.golang.org/grpc/status"
27+
"google.golang.org/protobuf/types/known/timestamppb"
2828
"k8s.io/klog/v2"
2929

3030
"github.com/kubernetes-csi/csi-driver-host-path/pkg/state"
@@ -104,7 +104,7 @@ func (hp *hostPath) CreateVolumeGroupSnapshot(ctx context.Context, req *csi.Crea
104104
groupSnapshot := state.GroupSnapshot{
105105
Name: req.GetName(),
106106
Id: uuid.NewUUID().String(),
107-
CreationTime: ptypes.TimestampNow(),
107+
CreationTime: timestamppb.Now(),
108108
SnapshotIDs: make([]string, len(req.GetSourceVolumeIds())),
109109
SourceVolumeIDs: make([]string, len(req.GetSourceVolumeIds())),
110110
ReadyToUse: true,

pkg/hostpath/hostpath.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"path/filepath"
2626
"sync"
2727

28+
"github.com/container-storage-interface/spec/lib/go/csi"
2829
"google.golang.org/grpc/codes"
2930
"google.golang.org/grpc/status"
3031
"k8s.io/apimachinery/pkg/api/resource"
@@ -49,6 +50,10 @@ const (
4950
)
5051

5152
type hostPath struct {
53+
csi.UnimplementedIdentityServer
54+
csi.UnimplementedControllerServer
55+
csi.UnimplementedNodeServer
56+
csi.UnimplementedGroupControllerServer
5257
config Config
5358

5459
// gRPC calls involving any of the fields below must be serialized

pkg/state/state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
"os"
2525
"sort"
2626

27-
timestamp "github.com/golang/protobuf/ptypes/timestamp"
2827
"google.golang.org/grpc/codes"
2928
"google.golang.org/grpc/status"
29+
"google.golang.org/protobuf/types/known/timestamppb"
3030
)
3131

3232
type AccessType int
@@ -63,7 +63,7 @@ type Snapshot struct {
6363
Id string
6464
VolID string
6565
Path string
66-
CreationTime *timestamp.Timestamp
66+
CreationTime *timestamppb.Timestamp
6767
SizeBytes int64
6868
ReadyToUse bool
6969
GroupSnapshotID string
@@ -74,7 +74,7 @@ type GroupSnapshot struct {
7474
Id string
7575
SnapshotIDs []string
7676
SourceVolumeIDs []string
77-
CreationTime *timestamp.Timestamp
77+
CreationTime *timestamppb.Timestamp
7878
ReadyToUse bool
7979
}
8080

0 commit comments

Comments
 (0)