Skip to content
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 @@ -4,8 +4,8 @@ go 1.23.10

require (
github.com/IBM/ibm-csi-common v1.1.21
github.com/IBM/ibmcloud-volume-file-vpc v1.2.10
github.com/IBM/ibmcloud-volume-interface v1.2.13
github.com/IBM/ibmcloud-volume-file-vpc v1.2.11-0.20250814105749-52259edf3782
github.com/IBM/ibmcloud-volume-interface v1.2.14-0.20250814073156-e83d804418e4
github.com/IBM/secret-utils-lib v1.1.14
github.com/container-storage-interface/spec v1.11.0
github.com/golang/glog v1.2.4
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ github.com/IBM/go-sdk-core/v5 v5.17.4 h1:VGb9+mRrnS2HpHZFM5hy4J6ppIWnwNrw0G+tLSg
github.com/IBM/go-sdk-core/v5 v5.17.4/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns=
github.com/IBM/ibm-csi-common v1.1.21 h1:/OmjpF+YgmkLmtehFmmfWp9kHGP9iMNkTU/KQDYXzrY=
github.com/IBM/ibm-csi-common v1.1.21/go.mod h1:AgjHhkYgDwYz1OmFGTgtOv+GCMsD67Yel+ZKsY90PYY=
github.com/IBM/ibmcloud-volume-file-vpc v1.2.10 h1:kzhBIAYd4j37jdWBjADANM+hBuun4QKdwPS90xYx33E=
github.com/IBM/ibmcloud-volume-file-vpc v1.2.10/go.mod h1:IQx9BDp+AE/IWAvjOS0i7oNz3oDkOg/pPkVx/bZqWSs=
github.com/IBM/ibmcloud-volume-interface v1.2.13 h1:7/uANoxNafhB0npJMUJfcFWgiUiovlcYudsk3mucY1g=
github.com/IBM/ibmcloud-volume-interface v1.2.13/go.mod h1:F9QxX6NZ4LLPGQ6YWVnYpW0JV+H+pZp8RY10PAZ76JA=
github.com/IBM/ibmcloud-volume-file-vpc v1.2.11-0.20250814105749-52259edf3782 h1:kBxaViwhvC1Ev3GhLkJRyXR4UNqZjJZ/sORd+vRcUuk=
github.com/IBM/ibmcloud-volume-file-vpc v1.2.11-0.20250814105749-52259edf3782/go.mod h1:nhIgj0QxNSGSYXVQ5Bq8XBbhCurbu+scK17iJU9UsK0=
github.com/IBM/ibmcloud-volume-interface v1.2.14-0.20250814073156-e83d804418e4 h1:EmTAbzsoCnyHohOFCJ4nqUvb2e9gU1WRTS7fOTuTONs=
github.com/IBM/ibmcloud-volume-interface v1.2.14-0.20250814073156-e83d804418e4/go.mod h1:F9QxX6NZ4LLPGQ6YWVnYpW0JV+H+pZp8RY10PAZ76JA=
github.com/IBM/secret-common-lib v1.1.13 h1:94YIuXew6lBXf0cfhyfM1iNUbUsV34abc4+BGvnXCTQ=
github.com/IBM/secret-common-lib v1.1.13/go.mod h1:33mQHLZyAq7HmS9SYDQXpf0OhBhe4TRHDaRBktDxnm0=
github.com/IBM/secret-utils-lib v1.1.14 h1:Gv5Ca2hZTQMr9+PkOq7AE2lUUnNEeQJ0uiKaxKT1Sdk=
Expand Down
17 changes: 16 additions & 1 deletion pkg/ibmcsidriver/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const (
// IOPS per PVC
IOPS = "iops"

// Throughput ...
Throughput = "throughput"

// SizeRangeSupported ...
SizeRangeSupported = "sizeRange"

Expand Down Expand Up @@ -59,6 +62,9 @@ const (
// DP2Profile ...
DP2Profile = "dp2"

// RFSProfile ...
RFSProfile = "rfs"

// ClassVersion ...
ClassVersion = "classVersion"

Expand Down Expand Up @@ -104,6 +110,9 @@ const (
//ENISubnetID ...
ENISubnetID = "ENISubnetId"

//ProfileLabel
ProfileLabel = "profile"

//ENISecurityGroupIds ...
ENISecurityGroupIDs = "ENISecurityGroupIds"

Expand All @@ -116,6 +125,9 @@ const (
// VolumeCRNLabel ...
VolumeCRNLabel = "volumeCRN"

//VolumeHrefLabel ...
VolumeHrefLabel = "volumeHref"

// ClusterIDLabel ...
ClusterIDLabel = "clusterID"

Expand All @@ -128,6 +140,9 @@ const (
// IOPSLabel ...
IOPSLabel = "iops"

// ThroughputLabel ...
ThroughputLabel = "throughput"

// ZoneLabel ...
ZoneLabel = "zone"

Expand Down Expand Up @@ -181,4 +196,4 @@ const (
var SupportedFS = []string{"nfs"}

// SupportedProfile the supported profile names
var SupportedProfile = []string{"dp2"}
var SupportedProfile = []string{"dp2", "rfs"}
6 changes: 6 additions & 0 deletions pkg/ibmcsidriver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package ibmcsidriver

import (
"fmt"
"os"
"strings"
"time"
Expand Down Expand Up @@ -110,6 +111,11 @@ func (csiCS *CSIControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
return nil, commonError.GetCSIError(ctxLogger, commonError.InvalidParameters, requestID, err)
}

if requestedVolume.Profile != nil && requestedVolume.Profile.Name == RFSProfile && !csiCS.Driver.rfsEnabled {
err = fmt.Errorf("RFS Profile is not accessible, please allowlist it from VPC team and restart the VPC FILE CSI Driver")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This we need to enhance so that user will have proper action

return nil, commonError.GetCSIError(ctxLogger, commonError.VolumeInvalidArguments, requestID, err)
}

// TODO: Determine Zones and Region for the disk

// Validate if volume Already Exists
Expand Down
71 changes: 56 additions & 15 deletions pkg/ibmcsidriver/controller_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
iops := value
volume.Iops = &iops
}
case Throughput:
// getting throughput value from storage class if it is provided
if len(value) != 0 {
bandwidth, errParse := strconv.ParseInt(value, 10, 32)
if errParse != nil {
err = fmt.Errorf("'<%v>' is invalid, value of '%s' should be an int32 type", value, key)
} else {
volume.VPCVolume.Bandwidth = int32(bandwidth)
}
}
case UID:
uid, err = strconv.Atoi(value)
if err != nil {
Expand Down Expand Up @@ -329,8 +339,29 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi

//TODO port the code from VPC BLOCK to find region if zone is given

// validate bandwidth for dp2 profile
if volume.VPCVolume.Profile != nil && volume.VPCVolume.Profile.Name == DP2Profile && volume.VPCVolume.Bandwidth > 0 {
err = fmt.Errorf("bandwidth is not supported for dp2 profile; please remove the property or set it to zero")
logger.Error("getVolumeParameters", zap.NamedError("invalidParameter", err))
return volume, err
}

// validation zone and iops for 'rfs' profile
if volume.VPCVolume.Profile != nil && volume.VPCVolume.Profile.Name == RFSProfile {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these code block can be optimised, we are checking Profile != nil again and again

if volume.Iops != nil && len(strings.TrimSpace(*volume.Iops)) > 0 {
err = fmt.Errorf("iops is not supported for rfs profile; please remove the iops parameter from the storage class")
logger.Error("getVolumeParameters", zap.NamedError("invalidParameter", err))
return volume, err
}
if len(strings.TrimSpace(volume.Az)) > 0 {
err = fmt.Errorf("zone is not supported for rfs profile; please remove the zone parameter from the storage class")
logger.Error("getVolumeParameters", zap.NamedError("invalidParameter", err))
return volume, err
}
}

//If the zone is not provided in storage class parameters then we pick from the Topology
if len(strings.TrimSpace(volume.Az)) == 0 {
if len(strings.TrimSpace(volume.Az)) == 0 && volume.VPCVolume.Profile.Name != RFSProfile {
zones, err := pickTargetTopologyParams(req.GetAccessibilityRequirements())
if err != nil {
err = fmt.Errorf("unable to fetch zone information: '%v'", err)
Expand Down Expand Up @@ -491,19 +522,19 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
volume.Region = value
}
case IOPS:
// Override IOPS only for custom or dp2
if volume.Capacity != nil && volume.VPCVolume.Profile != nil && volume.VPCVolume.Profile.Name == DP2Profile {
var iops int
var check bool
iops, err = strconv.Atoi(value)
if err != nil {
err = fmt.Errorf("%v:<%v> invalid value", key, value)
if len(value) != 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure this code should be released only for 2.0 driver

logger.Info("override (IOPS)", zap.Any(IOPS, value))
iopsStr := value
volume.Iops = &iopsStr
}
case Throughput:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughput is only supported for rfs profile, looks code is not uniform somewhere we are checking profile and taking action and somewhere its not

// getting throughput value from storage class if it is provided
if len(value) != 0 {
bandwidth, errParse := strconv.ParseInt(value, 10, 32)
if errParse != nil {
err = fmt.Errorf("'<%v>' is invalid, value of '%s' should be an int32 type", value, key)
} else {
if check, err = isValidCapacityIOPS(*(volume.Capacity), iops, volume.VPCVolume.Profile.Name); check {
iopsStr := value
logger.Info("override", zap.Any(IOPS, value))
volume.Iops = &iopsStr
}
volume.Bandwidth = int32(bandwidth)
}
}
case SecurityGroupIDs:
Expand Down Expand Up @@ -587,15 +618,25 @@ func createCSIVolumeResponse(vol provider.Volume, volAccessPointResponse provide

// Update labels for PV objects
labels[VolumeIDLabel] = vol.VolumeID + VolumeIDSeperator + volAccessPointResponse.AccessPointID
labels[VolumeCRNLabel] = vol.CRN
labels[ClusterIDLabel] = clusterID

if vol.VPCVolume.Profile != nil && vol.VPCVolume.Profile.Name != "" {
labels[ProfileLabel] = vol.VPCVolume.Profile.Name
}

if vol.VPCVolume.Href != "" {
labels[VolumeHrefLabel] = vol.VPCVolume.Href
}

labels[VolumeCRNLabel] = vol.CRN
labels[ClusterIDLabel] = clusterID
labels[Tag] = strings.Join(vol.Tags, ",")
if vol.Iops != nil && len(*vol.Iops) > 0 {
labels[IOPSLabel] = *vol.Iops
}

if vol.VPCVolume.Bandwidth > 0 {
labels[ThroughputLabel] = strconv.Itoa(int(vol.VPCVolume.Bandwidth)) + " " + "mbps"
}
labels[FileShareIDLabel] = vol.VolumeID
labels[FileShareTargetIDLabel] = volAccessPointResponse.AccessPointID

Expand Down
Loading