Skip to content

vpc acadia profile support #221

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

Merged
merged 5 commits into from
Apr 21, 2025
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ibmc-vpc-block-sdp
provisioner: vpc.block.csi.ibm.io
parameters:
profile: "sdp"
iops: ""
throughput: ""
csi.storage.k8s.io/fstype: "ext4"
billingType: "hourly"
encrypted: "false"
encryptionKey: ""
resourceGroup: ""
zone: ""
tags: ""
generation: "gc"
classVersion: "1"
reclaimPolicy: "Delete"
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.22.0

require (
github.com/IBM/ibm-csi-common v1.1.18
github.com/IBM/ibmcloud-volume-interface v1.2.9
github.com/IBM/ibmcloud-volume-vpc v1.1.15
github.com/IBM/ibmcloud-volume-interface v1.2.11
github.com/IBM/ibmcloud-volume-vpc v1.1.16
github.com/IBM/secret-utils-lib v1.1.12
github.com/container-storage-interface/spec v1.9.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 @@ -8,10 +8,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.18 h1:CbzoONFN6vdmPLoXGxygiq3sbr2xtAcVUb0Vqj3/HNI=
github.com/IBM/ibm-csi-common v1.1.18/go.mod h1:bDs9CLfr09kFpSMcR35e9AmyR2pSydx8goHjagFPrHs=
github.com/IBM/ibmcloud-volume-interface v1.2.9 h1:ug55V2mzK/IaFkfuKDOt74yzhLapSR/+qVgfQblfAjw=
github.com/IBM/ibmcloud-volume-interface v1.2.9/go.mod h1:sDeQiPuN8k9yTRl9FbE2GZCXPNg4cV3oldUfL8wwGNA=
github.com/IBM/ibmcloud-volume-vpc v1.1.15 h1:0TsFcTX8Enbma+gq3Lp9dNqB0NzlzGw+SR4hvPJsXMQ=
github.com/IBM/ibmcloud-volume-vpc v1.1.15/go.mod h1:CSAsBgEXN6WL8y/EpEj9GA+w+vs3fVLoRadtuCWUAz8=
github.com/IBM/ibmcloud-volume-interface v1.2.11 h1:6WfsSwfkLJggxlh2j7FDGU3hkZO8fsKzb54w5KHrvzA=
github.com/IBM/ibmcloud-volume-interface v1.2.11/go.mod h1:sDeQiPuN8k9yTRl9FbE2GZCXPNg4cV3oldUfL8wwGNA=
github.com/IBM/ibmcloud-volume-vpc v1.1.16 h1:jvxitm9Z2oBvZBLLYeAfULz7p8yy9BmBH8EYSQXNdfo=
github.com/IBM/ibmcloud-volume-vpc v1.1.16/go.mod h1:50mcqD68wGwQJ/W+jROhKuaDHqJUrnJO91cwsjQOYK0=
github.com/IBM/secret-common-lib v1.1.11 h1:EpfEe1gT1bnFQ3bxQPrh6bzTPeGjUo1NReVkCCP+TOc=
github.com/IBM/secret-common-lib v1.1.11/go.mod h1:7YJF0ipT979nHIPkiCpvjFboFoIhrmYnIliE1vjCjZM=
github.com/IBM/secret-utils-lib v1.1.12 h1:ASilsVPL6NnyUqPu5v/x3a083lrmXkNU+NIJJAobLOY=
Expand Down
3 changes: 3 additions & 0 deletions pkg/ibmcsidriver/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ const (

// MinimumSDPVolumeSizeInBytes ... This is minimum size require for sdp (acadia profile)
MinimumSDPVolumeSizeInBytes int64 = 1 * utils.GiB

// Throughput ...
Throughput = "throughput"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to call throughput on CSI side and bandwidht on RIAAS side ? Do we need to keep it same ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sameshai , actually I align with volumeattributeclass and what k8s talk about so it looks we need to have this mapping as k8s always talk about throughput

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

)

// SupportedFS the supported FS types
Expand Down
21 changes: 19 additions & 2 deletions pkg/ibmcsidriver/controller_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func getRequestedCapacity(capRange *csi.CapacityRange, profileName string) (int6
if profileName == SDPProfile { // SDP profile minimum size is 1GB
capBytes = MinimumSDPVolumeSizeInBytes
} else {
capBytes = utils.MinimumVolumeSizeInBytes // tierd and custom profile minimum size is 10 GB
capBytes = utils.MinimumVolumeSizeInBytes // tier and custom profile minimum size is 10 GB
}
// returns in GiB
return capBytes, nil
Expand Down Expand Up @@ -168,7 +168,15 @@ 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.Bandwidth = int32(bandwidth)
}
}
default:
err = fmt.Errorf("<%s> is an invalid parameter", key)
}
Expand Down Expand Up @@ -318,6 +326,15 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
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.Bandwidth = int32(bandwidth)
}
}
default:
err = fmt.Errorf("<%s> is an invalid parameter", key)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/ibmcsidriver/controller_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func TestGetVolumeParameters(t *testing.T) {
EncryptionKey: "key",
ClassVersion: "",
Generation: "generation",
Throughput: "1000",
IOPS: noIops,
},
},
Expand All @@ -202,6 +203,7 @@ func TestGetVolumeParameters(t *testing.T) {
Tags: []string{createdByIBM},
Profile: &provider.Profile{Name: "general-purpose"},
ResourceGroup: &provider.ResourceGroup{ID: "myresourcegroups"},
Bandwidth: 1000,
},
Region: "us-south-test",
Iops: &noIops,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 29 additions & 17 deletions vendor/github.com/IBM/ibmcloud-volume-vpc/block/provider/util.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ github.com/IBM/ibm-csi-common/pkg/metadata/fake
github.com/IBM/ibm-csi-common/pkg/metrics
github.com/IBM/ibm-csi-common/pkg/mountmanager
github.com/IBM/ibm-csi-common/pkg/utils
# github.com/IBM/ibmcloud-volume-interface v1.2.9
# github.com/IBM/ibmcloud-volume-interface v1.2.11
## explicit; go 1.22.0
github.com/IBM/ibmcloud-volume-interface/config
github.com/IBM/ibmcloud-volume-interface/lib/metrics
Expand All @@ -27,7 +27,7 @@ github.com/IBM/ibmcloud-volume-interface/lib/utils/reasoncode
github.com/IBM/ibmcloud-volume-interface/provider/auth
github.com/IBM/ibmcloud-volume-interface/provider/iam
github.com/IBM/ibmcloud-volume-interface/provider/local
# github.com/IBM/ibmcloud-volume-vpc v1.1.15
# github.com/IBM/ibmcloud-volume-vpc v1.1.16
## explicit; go 1.22.0
github.com/IBM/ibmcloud-volume-vpc/block/provider
github.com/IBM/ibmcloud-volume-vpc/block/utils
Expand Down