@@ -564,6 +564,12 @@ func createFakePVCWithVAC(requestBytes int64, vacName string) *v1.PersistentVolu
564
564
return claim
565
565
}
566
566
567
+ // createFakePVCWithVAC returns PVC with Annotations
568
+ func createFakePVCWithAnnotations (requestBytes int64 , annotations map [string ]string ) * v1.PersistentVolumeClaim {
569
+ claim := createFakeNamedPVC (requestBytes , "fake-pvc" , annotations )
570
+ return claim
571
+ }
572
+
567
573
// fakeClaim returns a valid PVC with the requested settings
568
574
func fakeClaim (name , namespace , claimUID string , capacity int64 , boundToVolume string , phase v1.PersistentVolumeClaimPhase , class * string , mode string ) * v1.PersistentVolumeClaim {
569
575
claim := v1.PersistentVolumeClaim {
@@ -2376,6 +2382,46 @@ func provisionTestcases() (int64, map[string]provisioningTestcase) {
2376
2382
},
2377
2383
expectState : controller .ProvisioningFinished ,
2378
2384
},
2385
+ "normal provision with custom params in annotations" : {
2386
+ pluginCapabilities : provisionWithVACCapabilities ,
2387
+ expectCreateVolDo : func (t * testing.T , ctx context.Context , req * csi.CreateVolumeRequest ) {
2388
+ if ! reflect .DeepEqual (req .MutableParameters , map [string ]string {"iops" : "10000" }) {
2389
+ t .Errorf ("Missing or incorrect mutable parameters" )
2390
+ }
2391
+ },
2392
+ volOpts : controller.ProvisionOptions {
2393
+ StorageClass : & storagev1.StorageClass {
2394
+ ReclaimPolicy : & deletePolicy ,
2395
+ Parameters : map [string ]string {
2396
+ "fstype" : "ext3" ,
2397
+ "test-param" : "from-sc" ,
2398
+ },
2399
+ },
2400
+ PVName : "test-name" ,
2401
+ PVC : createFakePVCWithAnnotations (requestedBytes , map [string ]string {driverName + "/iops" : "10000" }),
2402
+ },
2403
+ expectedPVSpec : & pvSpec {
2404
+ Name : "test-testi" ,
2405
+ Annotations : map [string ]string {
2406
+ annDeletionProvisionerSecretRefName : "" ,
2407
+ annDeletionProvisionerSecretRefNamespace : "" ,
2408
+ driverName + "/iops" : "10000" ,
2409
+ },
2410
+ ReclaimPolicy : v1 .PersistentVolumeReclaimDelete ,
2411
+ Capacity : v1.ResourceList {
2412
+ v1 .ResourceName (v1 .ResourceStorage ): bytesToQuantity (requestedBytes ),
2413
+ },
2414
+ CSIPVS : & v1.CSIPersistentVolumeSource {
2415
+ Driver : "test-driver" ,
2416
+ VolumeHandle : "test-volume-id" ,
2417
+ FSType : "ext3" ,
2418
+ VolumeAttributes : map [string ]string {
2419
+ "storage.kubernetes.io/csiProvisionerIdentity" : "test-provisioner" ,
2420
+ },
2421
+ },
2422
+ },
2423
+ expectState : controller .ProvisioningFinished ,
2424
+ },
2379
2425
"normal provision with VolumeAttributesClass but feature gate is disabled" : {
2380
2426
featureGates : map [featuregate.Feature ]bool {
2381
2427
features .VolumeAttributesClass : false ,
0 commit comments