Skip to content

Commit

Permalink
Refactor E2E: Standardize adding CreateVolume parameters to testcases
Browse files Browse the repository at this point in the history
Refactor E2E: Remove hidden performance parameter setting

Fixup E2E: Pre-Provisioned volumes don't use VolumeType

Fixup E2E: Pre-Provisioned defaultVolumeType typo

Refactor E2E: Standardize adding CreateVolume parameters to testcases

Refactor E2E: Generalize format_options CreateVolumeDetails helper fcn.
  • Loading branch information
AndrewSirenko committed Dec 1, 2023
1 parent 61c721b commit 73547e1
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 225 deletions.
3 changes: 3 additions & 0 deletions pkg/driver/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ const (
// BlockExpressKey increases the iops limit for io2 volumes to the block express limit
BlockExpressKey = "blockexpress"

// FSTypeKey configures the file system type that will be formatted during volume creation.
FSTypeKey = "csi.storage.k8s.io/fstype"

// BlockSizeKey configures the block size when formatting a volume
BlockSizeKey = "blocksize"

Expand Down
67 changes: 0 additions & 67 deletions tests/e2e/driver/ebs_csi_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,6 @@ func (d *ebsCSIDriver) GetPersistentVolume(volumeID string, fsType string, size
}
}

// GetParameters returns the parameters specific for this driver
func GetParameters(volumeType string, fsType string, encrypted bool, additionalParameters map[string]string) map[string]string {
parameters := map[string]string{
"type": volumeType,
"csi.storage.k8s.io/fstype": fsType,
}
if iopsPerGB := IOPSPerGBForVolumeType(volumeType); iopsPerGB != "" {
parameters[ebscsidriver.IopsPerGBKey] = iopsPerGB
}
if iops := IOPSForVolumeType(volumeType); iops != "" {
parameters[ebscsidriver.IopsKey] = iops
}
if throughput := ThroughputForVolumeType(volumeType); throughput != "" {
parameters[ebscsidriver.ThroughputKey] = throughput
}
if encrypted {
parameters[ebscsidriver.EncryptedKey] = True
}
for k, v := range additionalParameters {
parameters[k] = v
}

return parameters
}

// MinimumSizeForVolumeType returns the minimum disk size for each volumeType
func MinimumSizeForVolumeType(volumeType string) string {
switch volumeType {
Expand All @@ -148,45 +123,3 @@ func MinimumSizeForVolumeType(volumeType string) string {
return "1Gi"
}
}

// IOPSPerGBForVolumeType returns the maximum iops per GB for each volumeType
// Otherwise returns an empty string
func IOPSPerGBForVolumeType(volumeType string) string {
switch volumeType {
case "io1":
// Maximum IOPS/GB for io1 is 50
return "50"
case "io2":
// Maximum IOPS/GB for io2 is 500
return "500"
default:
return ""
}
}

// IOPSForVolumeType returns the maximum iops for each volumeType
// Otherwise returns an empty string
func IOPSForVolumeType(volumeType string) string {
switch volumeType {
case "gp3":
// Maximum IOPS for gp3 is 16000. However, maximum IOPS/GB for gp3 is 500.
// Since the tests will run using minimum volume capacity (1GB), set to 3000
// because minimum IOPS for gp3 is 3000.
return "3000"
default:
return ""
}
}

// ThroughputPerVolumeType returns the maximum throughput for each volumeType
// Otherwise returns an empty string
func ThroughputForVolumeType(volumeType string) string {
switch volumeType {
case "gp3":
// Maximum throughput for gp3 is 1000. However, maximum throughput/iops for gp3 is 0.25
// Since the default iops is 3000, set to 750.
return "750"
default:
return ""
}
}
Loading

0 comments on commit 73547e1

Please sign in to comment.