Skip to content

Commit c79ca4e

Browse files
authored
Merge pull request #53 from dell/feature/configurable-images
Configurable container images for cert-csi
2 parents 5c89db5 + 9b50afb commit c79ca4e

7 files changed

Lines changed: 317 additions & 51 deletions

File tree

pkg/cmd/certifycmd.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ func GetCertifyCommand() cli.Command {
8383
Usage: "path to certification config file",
8484
Required: true,
8585
},
86+
cli.StringFlag{
87+
Name: "image-config",
88+
Usage: "path to images config file",
89+
},
8690
cli.StringFlag{
8791
Name: "config, conf, c",
8892
Usage: "config for connecting to kubernetes",
@@ -181,6 +185,10 @@ func GetCertifyCommand() cli.Command {
181185
return fmt.Errorf("unable to decode Config: %s", err)
182186
}
183187

188+
testImage, err := getTestImage(c.String("image-config"))
189+
if err != nil {
190+
return fmt.Errorf("failed to get test image: %s", err)
191+
}
184192
// Parse timeout
185193
timeout, err := time.ParseDuration(c.String("timeout"))
186194
if err != nil {
@@ -212,6 +220,7 @@ func GetCertifyCommand() cli.Command {
212220
VolumeSize: minSize,
213221
ChainNumber: 2,
214222
ChainLength: 2,
223+
Image: testImage,
215224
})
216225

217226
s = append(s, &suites.ScalingSuite{
@@ -220,13 +229,15 @@ func GetCertifyCommand() cli.Command {
220229
GradualScaleDown: false,
221230
PodPolicy: "Parallel",
222231
VolumeSize: minSize,
232+
Image: testImage,
223233
})
224234

225235
if sc.Clone {
226236
s = append(s, &suites.CloneVolumeSuite{
227237
VolumeNumber: 1,
228238
PodNumber: 2,
229239
VolumeSize: minSize,
240+
Image: testImage,
230241
})
231242

232243
}
@@ -239,6 +250,7 @@ func GetCertifyCommand() cli.Command {
239250
PodNumber: 1,
240251
InitialSize: minSize,
241252
ExpandedSize: expSize.String(),
253+
Image: testImage,
242254
})
243255

244256
if sc.RawBlock {
@@ -248,6 +260,7 @@ func GetCertifyCommand() cli.Command {
248260
IsBlock: true,
249261
InitialSize: minSize,
250262
ExpandedSize: expSize.String(),
263+
Image: testImage,
251264
})
252265
}
253266
}
@@ -261,13 +274,15 @@ func GetCertifyCommand() cli.Command {
261274
SnapAmount: 3,
262275
SnapClass: snapClass,
263276
VolumeSize: minSize,
277+
Image: testImage,
264278
})
265279

266280
s = append(s, &suites.ReplicationSuite{
267281
VolumeNumber: 5,
268282
VolumeSize: minSize,
269283
PodNumber: 2,
270284
SnapClass: snapClass,
285+
Image: testImage,
271286
})
272287
}
273288

@@ -277,6 +292,7 @@ func GetCertifyCommand() cli.Command {
277292
RawBlock: true,
278293
AccessMode: "ReadWriteMany",
279294
VolumeSize: minSize,
295+
Image: testImage,
280296
})
281297
}
282298

@@ -286,6 +302,7 @@ func GetCertifyCommand() cli.Command {
286302
RawBlock: false,
287303
AccessMode: "ReadWriteMany",
288304
VolumeSize: minSize,
305+
Image: testImage,
289306
})
290307
}
291308

@@ -295,6 +312,7 @@ func GetCertifyCommand() cli.Command {
295312
VolumeNumber: 1,
296313
VolumeSize: minSize,
297314
Namespace: c.String("driver-namespace"),
315+
Image: testImage,
298316
})
299317
}
300318

@@ -304,6 +322,7 @@ func GetCertifyCommand() cli.Command {
304322
RawBlock: false,
305323
AccessMode: "ReadWriteOncePod",
306324
VolumeSize: minSize,
325+
Image: testImage,
307326
})
308327
}
309328

@@ -313,6 +332,7 @@ func GetCertifyCommand() cli.Command {
313332
FSType: sc.Ephemeral.FSType,
314333
PodNumber: 2,
315334
VolumeAttributes: sc.Ephemeral.VolumeAttributes,
335+
Image: testImage,
316336
})
317337
}
318338
if sc.VGS {
@@ -341,6 +361,7 @@ func GetCertifyCommand() cli.Command {
341361
VolumeNumber: 2,
342362
Driver: driverName,
343363
VolumeGroupName: vgsName,
364+
Image: testImage,
344365
})
345366
}
346367
if sc.CapacityTracking != nil {
@@ -349,6 +370,7 @@ func GetCertifyCommand() cli.Command {
349370
StorageClass: sc.Name,
350371
VolumeSize: minSize,
351372
PollInterval: sc.CapacityTracking.PollInterval,
373+
Image: testImage,
352374
})
353375
}
354376
log.Infof("Suites to run with %s storage class:", color.CyanString(sc.Name))

pkg/cmd/functionalcmd.go

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func GetFunctionalTestCommand() cli.Command {
6262
Name: "description, de",
6363
Usage: "To provide test case description",
6464
},
65+
cli.StringFlag{
66+
Name: "image-config",
67+
Usage: "path to images config file",
68+
},
6569
}
6670

6771
listCmd := cli.Command{
@@ -421,6 +425,10 @@ func getFunctionalCloneVolumeCommand(globalFlags []cli.Flag) cli.Command {
421425
pvcName := c.String("pvc-name")
422426
podName := c.String("pod-name")
423427
accessMode := c.String("access-mode")
428+
testImage, err := getTestImage(c.String("image-config"))
429+
if err != nil {
430+
return fmt.Errorf("failed to get test image: %s", err)
431+
}
424432

425433
s := []suites.Interface{
426434
&suites.CloneVolumeSuite{
@@ -430,6 +438,7 @@ func getFunctionalCloneVolumeCommand(globalFlags []cli.Flag) cli.Command {
430438
CustomPvcName: pvcName,
431439
CustomPodName: podName,
432440
AccessMode: accessMode,
441+
Image: testImage,
433442
},
434443
}
435444

@@ -488,6 +497,10 @@ func getFunctionalProvisioningCommand(globalFlags []cli.Flag) cli.Command {
488497
desc := c.String("description")
489498
volAccessMode := c.String("vol-access-mode")
490499
roFlag := c.Bool("roFlag")
500+
testImage, err := getTestImage(c.String("image-config"))
501+
if err != nil {
502+
return fmt.Errorf("failed to get test image: %s", err)
503+
}
491504
s := []suites.Interface{
492505
&suites.ProvisioningSuite{
493506
VolumeNumber: volNum,
@@ -497,6 +510,7 @@ func getFunctionalProvisioningCommand(globalFlags []cli.Flag) cli.Command {
497510
RawBlock: blockVol,
498511
VolAccessMode: volAccessMode,
499512
ROFlag: roFlag,
513+
Image: testImage,
500514
},
501515
}
502516

@@ -557,6 +571,10 @@ func getFunctionalSnapCreationCommand(globalFlags []cli.Flag) cli.Command {
557571
desc := c.String("description")
558572
snapName := c.String("snap-name")
559573
accessModeRestored := c.String("access-mode-restored-volume")
574+
testImage, err := getTestImage(c.String("image-config"))
575+
if err != nil {
576+
return fmt.Errorf("failed to get test image: %s", err)
577+
}
560578
s := []suites.Interface{
561579
&suites.SnapSuite{
562580
SnapClass: snapClass,
@@ -566,6 +584,7 @@ func getFunctionalSnapCreationCommand(globalFlags []cli.Flag) cli.Command {
566584
CustomSnapName: snapName,
567585
AccessModeOriginal: accessModeOriginal,
568586
AccessModeRestored: accessModeRestored,
587+
Image: testImage,
569588
},
570589
}
571590

@@ -611,13 +630,17 @@ func getFunctionalMultiAttachVolCommand(globalFlags []cli.Flag) cli.Command {
611630
desc := c.String("description")
612631
isRawBlock := c.Bool("block")
613632
accessMode := c.String("access-mode")
614-
633+
testImage, err := getTestImage(c.String("image-config"))
634+
if err != nil {
635+
return fmt.Errorf("failed to get test image: %s", err)
636+
}
615637
s := []suites.Interface{
616638
&suites.MultiAttachSuite{
617639
PodNumber: pods,
618640
RawBlock: isRawBlock,
619641
Description: desc,
620642
AccessMode: accessMode,
643+
Image: testImage,
621644
},
622645
}
623646

@@ -669,7 +692,10 @@ func getFunctionalEphemeralCreationCommand(globalFlags []cli.Flag) cli.Command {
669692
fsType := c.String("fs-type")
670693
attributesFile := c.String("csi-attributes")
671694
podName := c.String("pod-name")
672-
695+
testImage, err := getTestImage(c.String("image-config"))
696+
if err != nil {
697+
return fmt.Errorf("failed to get test image: %s", err)
698+
}
673699
// We will generate volumeAttributes by reading the properties file
674700
volAttributes, err := readEphemeralConfig(attributesFile)
675701
if err != nil {
@@ -685,6 +711,7 @@ func getFunctionalEphemeralCreationCommand(globalFlags []cli.Flag) cli.Command {
685711
VolumeAttributes: volAttributes,
686712
Description: desc,
687713
PodCustomName: podName,
714+
Image: testImage,
688715
},
689716
}
690717

@@ -850,12 +877,17 @@ func getCapacityTrackingCommand(globalFlags []cli.Flag) cli.Command {
850877
storageClass := c.String("sc")
851878
volumeSize := c.String("volSize")
852879
pollInterval := c.Duration("poll-interval")
880+
testImage, err := getTestImage(c.String("image-config"))
881+
if err != nil {
882+
return fmt.Errorf("failed to get test image: %s", err)
883+
}
853884
s := []suites.Interface{
854885
&suites.CapacityTrackingSuite{
855886
DriverNamespace: driverns,
856887
StorageClass: storageClass,
857888
VolumeSize: volumeSize,
858889
PollInterval: pollInterval,
890+
Image: testImage,
859891
},
860892
}
861893

0 commit comments

Comments
 (0)