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

Update CSI spec dependency to v1.11.0 #3171

Open
wants to merge 1 commit 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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.8
require (
github.com/agiledragon/gomonkey/v2 v2.3.1
github.com/akutz/gofsutil v0.1.2
github.com/container-storage-interface/spec v1.9.0
github.com/container-storage-interface/spec v1.11.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/evanphx/json-patch/v5 v5.9.0
github.com/fsnotify/fsnotify v1.7.0
Expand All @@ -27,6 +27,7 @@ require (
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.26.0
golang.org/x/sync v0.10.0
golang.org/x/sys v0.24.0
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.34.2
gopkg.in/gcfg.v1 v1.2.3
Expand Down Expand Up @@ -164,7 +165,6 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ github.com/cilium/ebpf v0.9.1/go.mod h1:+OhNOIXx/Fnu1IE8bJz2dzOA+VSfyTfdNUVdlQnx
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
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.11.0 h1:H/YKTOeUZwHtyPOr9raR+HgFmGluGCklulxDYxSdVNM=
github.com/container-storage-interface/spec v1.11.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI=
github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU=
github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM=
github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw=
Expand Down
20 changes: 6 additions & 14 deletions pkg/csi/service/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,17 @@ var (
// BlockVolumeCaps represents how the block volume could be accessed.
// CNS block volumes support only SINGLE_NODE_WRITER where the volume is
// attached to a single node at any given time.
BlockVolumeCaps = []csi.VolumeCapability_AccessMode{
{
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
},
BlockVolumeCaps = []csi.VolumeCapability_AccessMode_Mode{
csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
}

// FileVolumeCaps represents how the file volume could be accessed.
// CNS file volumes supports MULTI_NODE_READER_ONLY, MULTI_NODE_SINGLE_WRITER
// and MULTI_NODE_MULTI_WRITER
FileVolumeCaps = []csi.VolumeCapability_AccessMode{
{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY,
},
{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_SINGLE_WRITER,
},
{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
},
FileVolumeCaps = []csi.VolumeCapability_AccessMode_Mode{
csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY,
csi.VolumeCapability_AccessMode_MULTI_NODE_SINGLE_WRITER,
csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
}

// ErrNotFound represents not found error
Expand Down
4 changes: 2 additions & 2 deletions pkg/csi/service/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ func IsVolumeReadOnly(capability *csi.VolumeCapability) bool {
// validateVolumeCapabilities validates the access mode in given volume
// capabilities in validAccessModes.
func validateVolumeCapabilities(volCaps []*csi.VolumeCapability,
validAccessModes []csi.VolumeCapability_AccessMode, volumeType string) error {
validAccessModes []csi.VolumeCapability_AccessMode_Mode, volumeType string) error {
// Validate if all capabilities of the volume are supported.
for _, volCap := range volCaps {
found := false
for _, validAccessMode := range validAccessModes {
if volCap.AccessMode.GetMode() == validAccessMode.GetMode() {
if volCap.AccessMode.GetMode() == validAccessMode {
found = true
break
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/csi/service/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ type vsphereCSIDriver struct {
// A map storing all volumes with ongoing operations so that additional operations
// for that same volume (as defined by VolumeID) return an Aborted error
volumeLocks *node.VolumeLocks
csi.UnimplementedNodeServer
csi.UnimplementedIdentityServer
}

// If k8s node died unexpectedly in an earlier run, the unix socket is left
Expand Down
16 changes: 9 additions & 7 deletions pkg/csi/service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"os"
"strconv"

"google.golang.org/protobuf/encoding/prototext"

"github.com/container-storage-interface/spec/lib/go/csi"
cnstypes "github.com/vmware/govmomi/cns/types"
"github.com/vmware/govmomi/units"
Expand Down Expand Up @@ -52,7 +54,7 @@ func (driver *vsphereCSIDriver) NodeStageVolume(
*csi.NodeStageVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodeStageVolume: called with args %+v", *req)
log.Infof("NodeStageVolume: called with args %+v", prototext.Format(req))

volumeID := req.GetVolumeId()
volCap := req.GetVolumeCapability()
Expand Down Expand Up @@ -113,7 +115,7 @@ func (driver *vsphereCSIDriver) NodeUnstageVolume(
*csi.NodeUnstageVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodeUnstageVolume: called with args %+v", *req)
log.Infof("NodeUnstageVolume: called with args %+v", prototext.Format(req))

// Validate arguments
volumeID := req.GetVolumeId()
Expand Down Expand Up @@ -178,7 +180,7 @@ func (driver *vsphereCSIDriver) NodePublishVolume(
*csi.NodePublishVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodePublishVolume: called with args %+v", *req)
log.Infof("NodePublishVolume: called with args %+v", prototext.Format(req))
var err error
volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
Expand Down Expand Up @@ -246,7 +248,7 @@ func (driver *vsphereCSIDriver) NodeUnpublishVolume(
*csi.NodeUnpublishVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodeUnpublishVolume: called with args %+v", *req)
log.Infof("NodeUnpublishVolume: called with args %+v", prototext.Format(req))

volID := req.GetVolumeId()
target := req.GetTargetPath()
Expand Down Expand Up @@ -276,7 +278,7 @@ func (driver *vsphereCSIDriver) NodeGetVolumeStats(
*csi.NodeGetVolumeStatsResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodeGetVolumeStats: called with args %+v", *req)
log.Infof("NodeGetVolumeStats: called with args %+v", prototext.Format(req))

var err error
targetPath := req.GetVolumePath()
Expand Down Expand Up @@ -378,7 +380,7 @@ func (driver *vsphereCSIDriver) NodeGetInfo(
*csi.NodeGetInfoResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodeGetInfo: called with args %+v", *req)
log.Infof("NodeGetInfo: called with args %+v", prototext.Format(req))

driver.osUtils.ShouldContinue(ctx)

Expand Down Expand Up @@ -514,7 +516,7 @@ func (driver *vsphereCSIDriver) NodeExpandVolume(
*csi.NodeExpandVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("NodeExpandVolume: called with args %+v", *req)
log.Infof("NodeExpandVolume: called with args %+v", prototext.Format(req))

volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
Expand Down
39 changes: 21 additions & 18 deletions pkg/csi/service/vanilla/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/vmware/govmomi/units"
"github.com/vmware/govmomi/vim25/types"
"google.golang.org/grpc/codes"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/types/known/timestamppb"
apierrors "k8s.io/apimachinery/pkg/api/errors"

Expand Down Expand Up @@ -79,6 +80,7 @@ type controller struct {
authMgr common.AuthorizationService
authMgrs map[string]*common.AuthManager
topologyMgr commoncotypes.ControllerTopologyService
csi.UnimplementedControllerServer
}

var (
Expand Down Expand Up @@ -1958,7 +1960,7 @@ func (c *controller) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequ
volumeType := prometheus.PrometheusUnknownVolumeType
createVolumeInternal := func() (
*csi.CreateVolumeResponse, string, error) {
log.Infof("CreateVolume: called with args %+v", *req)
log.Infof("CreateVolume: called with args %+v", prototext.Format(req))
// TODO: If the err is returned by invoking CNS API, then faultType should be
// populated by the underlying layer.
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
Expand Down Expand Up @@ -2051,7 +2053,7 @@ func (c *controller) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequ

deleteVolumeInternal := func() (
*csi.DeleteVolumeResponse, string, error) {
log.Infof("DeleteVolume: called with args: %+v", *req)
log.Infof("DeleteVolume: called with args: %+v", prototext.Format(req))
// TODO: If the err is returned by invoking CNS API, then faultType should be
// populated by the underlying layer.
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
Expand Down Expand Up @@ -2194,7 +2196,7 @@ func (c *controller) ControllerPublishVolume(ctx context.Context, req *csi.Contr

controllerPublishVolumeInternal := func() (
*csi.ControllerPublishVolumeResponse, string, error) {
log.Infof("ControllerPublishVolume: called with args %+v", *req)
log.Infof("ControllerPublishVolume: called with args %+v", prototext.Format(req))
// TODO: If the err is returned by invoking CNS API, then faultType should be
// populated by the underlying layer.
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
Expand All @@ -2205,7 +2207,7 @@ func (c *controller) ControllerPublishVolume(ctx context.Context, req *csi.Contr
if err != nil {

return nil, csifault.CSIInvalidArgumentFault, logger.LogNewErrorCodef(log, codes.Internal,
"validation for PublishVolume Request: %+v has failed. Error: %v", *req, err)
"validation for PublishVolume Request: %+v has failed. Error: %v", prototext.Format(req), err)
}
publishInfo := make(map[string]string)
_, volumeManager, err := getVCenterAndVolumeManagerForVolumeID(ctx, c, req.VolumeId, volumeInfoService)
Expand Down Expand Up @@ -2342,7 +2344,7 @@ func (c *controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con
controllerUnpublishVolumeInternal := func() (
*csi.ControllerUnpublishVolumeResponse, string, error) {
var faultType string
log.Infof("ControllerUnpublishVolume: called with args %+v", *req)
log.Infof("ControllerUnpublishVolume: called with args %+v", prototext.Format(req))
// TODO: If the err is returned by invoking CNS API, then faultType should be
// populated by the underlying layer.
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
Expand All @@ -2352,7 +2354,7 @@ func (c *controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con
err := validateVanillaControllerUnpublishVolumeRequest(ctx, req)
if err != nil {
return nil, csifault.CSIInvalidArgumentFault, logger.LogNewErrorCodef(log, codes.Internal,
"validation for UnpublishVolume Request: %+v has failed. Error: %v", *req, err)
"validation for UnpublishVolume Request: %+v has failed. Error: %v", prototext.Format(req), err)
}

_, volumeManager, err := getVCenterAndVolumeManagerForVolumeID(ctx, c, req.VolumeId, volumeInfoService)
Expand Down Expand Up @@ -2485,7 +2487,7 @@ func (c *controller) ControllerExpandVolume(ctx context.Context, req *csi.Contro
faultType string
)

log.Infof("ControllerExpandVolume: called with args %+v", *req)
log.Infof("ControllerExpandVolume: called with args %+v", prototext.Format(req))
// TODO: If the err is returned by invoking CNS API, then faultType should be
// populated by the underlying layer.
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
Expand Down Expand Up @@ -2522,7 +2524,8 @@ func (c *controller) ControllerExpandVolume(ctx context.Context, req *csi.Contro
isOnlineExpansionEnabled := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.OnlineVolumeExtend)
err = validateVanillaControllerExpandVolumeRequest(ctx, req, isOnlineExpansionEnabled, isOnlineExpansionSupported)
if err != nil {
msg := fmt.Sprintf("validation for ExpandVolume Request: %+v has failed. Error: %v", *req, err)
msg := fmt.Sprintf("validation for ExpandVolume Request: %+v has failed. Error: %v",
prototext.Format(req), err)
log.Error(msg)
return nil, csifault.CSIInternalFault, err
}
Expand Down Expand Up @@ -2607,7 +2610,7 @@ func (c *controller) ValidateVolumeCapabilities(ctx context.Context, req *csi.Va
*csi.ValidateVolumeCapabilitiesResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("ControllerGetCapabilities: called with args %+v", *req)
log.Infof("ControllerGetCapabilities: called with args %+v", prototext.Format(req))
volCaps := req.GetVolumeCapabilities()
var confirmed *csi.ValidateVolumeCapabilitiesResponse_Confirmed
if err := common.IsValidVolumeCapabilities(ctx, volCaps); err == nil {
Expand Down Expand Up @@ -2639,7 +2642,7 @@ func (c *controller) ListVolumes(ctx context.Context, req *csi.ListVolumesReques
}

listVolumesInternal := func() (*csi.ListVolumesResponse, string, error) {
log.Debugf("ListVolumes: called with args %+v", *req)
log.Debugf("ListVolumes: called with args %+v", prototext.Format(req))

startingToken := 0
if req.StartingToken != "" {
Expand Down Expand Up @@ -2871,7 +2874,7 @@ func (c *controller) GetCapacity(ctx context.Context, req *csi.GetCapacityReques
*csi.GetCapacityResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("GetCapacity: called with args %+v", *req)
log.Infof("GetCapacity: called with args %+v", prototext.Format(req))
return nil, logger.LogNewErrorCode(log, codes.Unimplemented, "getCapacity")
}

Expand Down Expand Up @@ -2915,7 +2918,7 @@ func (c *controller) ControllerGetCapabilities(ctx context.Context, req *csi.Con
*csi.ControllerGetCapabilitiesResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("ControllerGetCapabilities: called with args %+v", *req)
log.Infof("ControllerGetCapabilities: called with args %+v", prototext.Format(req))

controllerCaps := []csi.ControllerServiceCapability_RPC_Type{
csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
Expand Down Expand Up @@ -2956,7 +2959,7 @@ func (c *controller) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshot
granularMaxSnapshotsPerBlockVolumeInVSAN int
granularMaxSnapshotsPerBlockVolumeInVVOL int
)
log.Infof("CreateSnapshot: called with args %+v", *req)
log.Infof("CreateSnapshot: called with args %+v", prototext.Format(req))

isBlockVolumeSnapshotEnabled := commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.BlockVolumeSnapshot)
if !isBlockVolumeSnapshotEnabled {
Expand Down Expand Up @@ -2986,7 +2989,7 @@ func (c *controller) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshot
// Validate CreateSnapshotRequest
if err := validateVanillaCreateSnapshotRequestRequest(ctx, req); err != nil {
return nil, logger.LogNewErrorCodef(log, codes.Internal,
"validation for CreateSnapshot Request: %+v has failed. Error: %v", *req, err)
"validation for CreateSnapshot Request: %+v has failed. Error: %v", prototext.Format(req), err)
}

// Check if the source volume is migrated vSphere volume
Expand Down Expand Up @@ -3117,7 +3120,7 @@ func (c *controller) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshot
volumeManager cnsvolume.Manager
err error
)
log.Infof("DeleteSnapshot: called with args %+v", *req)
log.Infof("DeleteSnapshot: called with args %+v", prototext.Format(req))

isBlockVolumeSnapshotEnabled :=
commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.BlockVolumeSnapshot)
Expand Down Expand Up @@ -3193,7 +3196,7 @@ func (c *controller) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRe
nextToken string
err error
)
log.Infof("ListSnapshots: called with args %+v", *req)
log.Infof("ListSnapshots: called with args %+v", prototext.Format(req))
err = validateVanillaListSnapshotRequest(ctx, req)
if err != nil {
return nil, err
Expand Down Expand Up @@ -3468,14 +3471,14 @@ func (c *controller) ControllerGetVolume(ctx context.Context, req *csi.Controlle
*csi.ControllerGetVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("ControllerGetVolume: called with args %+v", *req)
log.Infof("ControllerGetVolume: called with args %+v", prototext.Format(req))
return nil, logger.LogNewErrorCode(log, codes.Unimplemented, "controllerGetVolume")
}

func (c *controller) ControllerModifyVolume(ctx context.Context, req *csi.ControllerModifyVolumeRequest) (
*csi.ControllerModifyVolumeResponse, error) {
ctx = logger.NewContextWithLogger(ctx)
log := logger.GetLogger(ctx)
log.Infof("ControllerModifyVolume: called with args %+v", *req)
log.Infof("ControllerModifyVolume: called with args %+v", prototext.Format(req))
return nil, logger.LogNewErrorCode(log, codes.Unimplemented, "ControllerModifyVolume")
}
10 changes: 6 additions & 4 deletions pkg/csi/service/vanilla/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/vmware/govmomi/pbm/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/encoding/prototext"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/vmware/govmomi/simulator"
Expand Down Expand Up @@ -766,7 +767,7 @@ func TestExtendVolume(t *testing.T) {
},
VolumeCapability: capabilities[0],
}
t.Logf("ControllerExpandVolume will be called with req +%v", *reqExpand)
t.Logf("ControllerExpandVolume will be called with req +%v", prototext.Format(reqExpand))
respExpand, err := ct.controller.ControllerExpandVolume(ctx, reqExpand)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -824,7 +825,7 @@ func TestMigratedExtendVolume(t *testing.T) {
RequiredBytes: 1024,
},
}
t.Logf("ControllerExpandVolume will be called with req +%v", *reqExpand)
t.Logf("ControllerExpandVolume will be called with req +%v", prototext.Format(reqExpand))
_, err := ct.controller.ControllerExpandVolume(ctx, reqExpand)
if err != nil {
t.Logf("Expected error received. migrated volume with VMDK path can not be expanded")
Expand Down Expand Up @@ -913,7 +914,7 @@ func TestCompleteControllerFlow(t *testing.T) {
VolumeCapability: capabilities[0],
Readonly: false,
}
t.Logf("ControllerPublishVolume will be called with req +%v", *reqControllerPublishVolume)
t.Logf("ControllerPublishVolume will be called with req +%v", prototext.Format(reqControllerPublishVolume))
respControllerPublishVolume, err := ct.controller.ControllerPublishVolume(ctx, reqControllerPublishVolume)
if err != nil {
t.Fatal(err)
Expand All @@ -926,7 +927,8 @@ func TestCompleteControllerFlow(t *testing.T) {
VolumeId: volID,
NodeId: NodeID,
}
t.Logf("ControllerUnpublishVolume will be called with req +%v", *reqControllerUnpublishVolume)
t.Logf("ControllerUnpublishVolume will be called with req +%v",
prototext.Format(reqControllerUnpublishVolume))
_, err = ct.controller.ControllerUnpublishVolume(ctx, reqControllerUnpublishVolume)
if err != nil {
t.Fatal(err)
Expand Down
Loading