Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump CSI spec to next version #515

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/kubernetes-csi/csi-driver-host-path
go 1.21

require (
github.com/container-storage-interface/spec v1.9.0
github.com/container-storage-interface/spec v1.9.1-0.20240314114506-2696773158b9
github.com/golang/glog v1.2.1
github.com/golang/protobuf v1.5.4
github.com/kubernetes-csi/csi-lib-utils v0.17.0
github.com/pborman/uuid v1.2.1
github.com/stretchr/testify v1.9.0
golang.org/x/net v0.26.0
google.golang.org/grpc v1.64.0
google.golang.org/protobuf v1.33.0
k8s.io/apimachinery v0.29.0
k8s.io/klog/v2 v2.130.0
k8s.io/kubernetes v1.29.2
Expand All @@ -24,6 +24,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand All @@ -37,7 +38,6 @@ require (
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.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.9.1-0.20240314114506-2696773158b9 h1:5UgaRsvTkHbRDuDjMIC48samtUi8eHil0fzTutNLXLo=
github.com/container-storage-interface/spec v1.9.1-0.20240314114506-2696773158b9/go.mod h1:BoqFHNGrbQQUw8a2TOr2IFMWlfGStBwfh6RU1dqS6k8=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
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
19 changes: 9 additions & 10 deletions pkg/hostpath/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import (
"sort"
"strconv"

"github.com/golang/protobuf/ptypes"

"github.com/golang/glog"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/pborman/uuid"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
"google.golang.org/protobuf/types/known/wrapperspb"

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

return &csi.GetCapacityResponse{
AvailableCapacity: available,
MaximumVolumeSize: &wrappers.Int64Value{Value: maxVolumeSize},
MaximumVolumeSize: &wrapperspb.Int64Value{Value: maxVolumeSize},

// We don't have a minimum volume size, so we might as well report that.
// Better explicit than implicit...
MinimumVolumeSize: &wrappers.Int64Value{Value: 0},
MinimumVolumeSize: &wrapperspb.Int64Value{Value: 0},
}, nil
}

Expand Down Expand Up @@ -462,7 +461,7 @@ func (hp *hostPath) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest
})
}

glog.V(5).Infof("Volumes are: %+v", *volumeRes)
glog.V(5).Infof("Volumes are: %+v", volumeRes)
return volumeRes, nil
}

Expand Down Expand Up @@ -585,7 +584,7 @@ func (hp *hostPath) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotR
}

snapshotID := uuid.NewUUID().String()
creationTime := ptypes.TimestampNow()
creationTime := timestamppb.Now()
file := hp.getSnapshotPath(snapshotID)

if err := hp.createSnapshotFromVolume(hostPathVolume, file); err != nil {
Expand Down Expand Up @@ -679,15 +678,15 @@ func (hp *hostPath) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsReq
return &csi.ListSnapshotsResponse{}, nil
}

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

for _, snap := range hpSnapshots {
snapshot := csi.Snapshot{
snapshot := &csi.Snapshot{
SnapshotId: snap.Id,
SourceVolumeId: snap.VolID,
CreationTime: snap.CreationTime,
Expand Down Expand Up @@ -742,7 +741,7 @@ func (hp *hostPath) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsReq

for i = 0; i < len(entries); i++ {
entries[i] = &csi.ListSnapshotsResponse_Entry{
Snapshot: &snapshots[j],
Snapshot: snapshots[j],
}
j++
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/hostpath/groupcontrollerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"github.com/golang/protobuf/ptypes"
"github.com/pborman/uuid"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/kubernetes-csi/csi-driver-host-path/pkg/state"
)
Expand Down Expand Up @@ -104,7 +104,7 @@ func (hp *hostPath) CreateVolumeGroupSnapshot(ctx context.Context, req *csi.Crea
groupSnapshot := state.GroupSnapshot{
Name: req.GetName(),
Id: uuid.NewUUID().String(),
CreationTime: ptypes.TimestampNow(),
CreationTime: timestamppb.Now(),
SnapshotIDs: make([]string, len(req.GetSourceVolumeIds())),
SourceVolumeIDs: make([]string, len(req.GetSourceVolumeIds())),
ReadyToUse: true,
Expand Down
5 changes: 5 additions & 0 deletions pkg/hostpath/hostpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"path/filepath"
"sync"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand All @@ -49,6 +50,10 @@ const (
)

type hostPath struct {
csi.UnimplementedIdentityServer
csi.UnimplementedControllerServer
csi.UnimplementedNodeServer
csi.UnimplementedGroupControllerServer
config Config

// gRPC calls involving any of the fields below must be serialized
Expand Down
6 changes: 3 additions & 3 deletions pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"os"
"sort"

timestamp "github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
)

type AccessType int
Expand Down Expand Up @@ -63,7 +63,7 @@ type Snapshot struct {
Id string
VolID string
Path string
CreationTime *timestamp.Timestamp
CreationTime *timestamppb.Timestamp
SizeBytes int64
ReadyToUse bool
GroupSnapshotID string
Expand All @@ -74,7 +74,7 @@ type GroupSnapshot struct {
Id string
SnapshotIDs []string
SourceVolumeIDs []string
CreationTime *timestamp.Timestamp
CreationTime *timestamppb.Timestamp
ReadyToUse bool
}

Expand Down
Loading