Skip to content

Commit fdde8b0

Browse files
committed
AWS: Add the ability to configure throughput on GP3 volumes
GP3 volumes have the ability to configure throughput from 125 MiB/s to 2000 MiB/s. This allows the ability to set this at install time in the install-config. https://issues.redhat.com/browse/CORS-4212
1 parent 567aa4a commit fdde8b0

File tree

7 files changed

+77
-9
lines changed

7 files changed

+77
-9
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ spec:
221221
(GiB).
222222
minimum: 0
223223
type: integer
224+
throughput:
225+
description: |-
226+
Throughput to provision in MiB/s supported for the volume type. This
227+
is currently only applicable to volumes of type gp3.
228+
format: int64
229+
minimum: 0
230+
type: integer
224231
type:
225232
description: Type defines the type of the volume.
226233
type: string
@@ -1739,6 +1746,13 @@ spec:
17391746
gibibytes (GiB).
17401747
minimum: 0
17411748
type: integer
1749+
throughput:
1750+
description: |-
1751+
Throughput to provision in MiB/s supported for the volume type. This
1752+
is currently only applicable to volumes of type gp3.
1753+
format: int64
1754+
minimum: 0
1755+
type: integer
17421756
type:
17431757
description: Type defines the type of the volume.
17441758
type: string
@@ -3197,6 +3211,13 @@ spec:
31973211
(GiB).
31983212
minimum: 0
31993213
type: integer
3214+
throughput:
3215+
description: |-
3216+
Throughput to provision in MiB/s supported for the volume type. This
3217+
is currently only applicable to volumes of type gp3.
3218+
format: int64
3219+
minimum: 0
3220+
type: integer
32003221
type:
32013222
description: Type defines the type of the volume.
32023223
type: string
@@ -4848,6 +4869,13 @@ spec:
48484869
(GiB).
48494870
minimum: 0
48504871
type: integer
4872+
throughput:
4873+
description: |-
4874+
Throughput to provision in MiB/s supported for the volume type. This
4875+
is currently only applicable to volumes of type gp3.
4876+
format: int64
4877+
minimum: 0
4878+
type: integer
48514879
type:
48524880
description: Type defines the type of the volume.
48534881
type: string

docs/user/aws/customization.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Beyond the [platform-agnostic `install-config.yaml` properties](../customization
1818
* `rootVolume` (optional object): Defines the root volume for EC2 instances in the machine pool.
1919
* `iops` (optional integer): The amount of provisioned [IOPS][volume-iops].
2020
This is only valid for `type` `io1`.
21+
* `throughput` (optional integer): The amount of throughput in MiB/s [Throughput Performance][volume-throughput].
22+
This is only valid for `type` `gp3`.
2123
* `size` (optional integer): Size of the root volume in gibibytes (GiB).
2224
* `type` (optional string): The [type of volume][volume-type].
2325
* `kmsKeyARN` (optional string): The [ARN of KMS key][kms-key] that should be used to encrypt the EBS volume.
@@ -119,4 +121,5 @@ sshKey: ssh-ed25519 AAAA...
119121
[kms-key-default]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetEbsDefaultKmsKeyId.html
120122
[kms-key]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html
121123
[volume-iops]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-io-characteristics.html
124+
[volume-throughput]: https://docs.aws.amazon.com/ebs/latest/userguide/general-purpose.html#gp3-ebs-volume-type
122125
[volume-type]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html

pkg/asset/machines/aws/awsmachines.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func GenerateMachines(clusterID string, in *MachineInput) ([]*asset.RuntimeFile,
107107
Size: int64(mpool.EC2RootVolume.Size),
108108
Type: capa.VolumeType(mpool.EC2RootVolume.Type),
109109
IOPS: int64(mpool.EC2RootVolume.IOPS),
110+
Throughput: ptr.To(mpool.EC2RootVolume.Throughput),
110111
Encrypted: ptr.To(true),
111112
EncryptionKey: mpool.KMSKeyARN,
112113
},

pkg/asset/machines/aws/awsmachines_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ func TestGenerateMachines(t *testing.T) {
115115
},
116116
SSHKeyName: ptr.To(""),
117117
RootVolume: &capa.Volume{
118-
Encrypted: ptr.To(true),
118+
Encrypted: ptr.To(true),
119+
Throughput: ptr.To(int64(0)),
119120
},
120121
UncompressedUserData: ptr.To(true),
121122
Ignition: &capa.Ignition{
@@ -171,7 +172,8 @@ func TestGenerateMachines(t *testing.T) {
171172
},
172173
SSHKeyName: ptr.To(""),
173174
RootVolume: &capa.Volume{
174-
Encrypted: ptr.To(true),
175+
Encrypted: ptr.To(true),
176+
Throughput: ptr.To(int64(0)),
175177
},
176178
UncompressedUserData: ptr.To(true),
177179
Ignition: &capa.Ignition{
@@ -227,8 +229,11 @@ func TestGenerateMachines(t *testing.T) {
227229
fmt.Sprintf("%s-subnet-public-%s", stubClusterID, machineZone),
228230
}}},
229231
},
230-
SSHKeyName: ptr.To(""),
231-
RootVolume: &capa.Volume{Encrypted: ptr.To(true)},
232+
SSHKeyName: ptr.To(""),
233+
RootVolume: &capa.Volume{
234+
Encrypted: ptr.To(true),
235+
Throughput: ptr.To(int64(0)),
236+
},
232237
UncompressedUserData: ptr.To(true),
233238
Ignition: &capa.Ignition{
234239
StorageType: capa.IgnitionStorageTypeOptionUnencryptedUserData,

pkg/asset/machines/aws/machines.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,12 @@ func provider(in *machineProviderInput) (*machineapi.AWSMachineProviderConfig, e
239239
BlockDevices: []machineapi.BlockDeviceMappingSpec{
240240
{
241241
EBS: &machineapi.EBSBlockDeviceSpec{
242-
VolumeType: pointer.String(in.root.Type),
243-
VolumeSize: pointer.Int64(int64(in.root.Size)),
244-
Iops: pointer.Int64(int64(in.root.IOPS)),
245-
Encrypted: pointer.Bool(true),
246-
KMSKey: machineapi.AWSResourceReference{ARN: pointer.String(in.root.KMSKeyARN)},
242+
VolumeType: pointer.String(in.root.Type),
243+
VolumeSize: pointer.Int64(int64(in.root.Size)),
244+
Iops: pointer.Int64(int64(in.root.IOPS)),
245+
ThroughputMib: pointer.Int32(int32(in.root.Throughput)),
246+
Encrypted: pointer.Bool(true),
247+
KMSKey: machineapi.AWSResourceReference{ARN: pointer.String(in.root.KMSKeyARN)},
247248
},
248249
},
249250
},

pkg/types/aws/machinepool.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func (a *MachinePool) Set(required *MachinePool) {
7171
if required.EC2RootVolume.IOPS != 0 {
7272
a.EC2RootVolume.IOPS = required.EC2RootVolume.IOPS
7373
}
74+
if required.EC2RootVolume.Throughput != 0 {
75+
a.EC2RootVolume.Throughput = required.EC2RootVolume.Throughput
76+
}
7477
if required.EC2RootVolume.Size != 0 {
7578
a.EC2RootVolume.Size = required.EC2RootVolume.Size
7679
}
@@ -107,6 +110,13 @@ type EC2RootVolume struct {
107110
// +optional
108111
IOPS int `json:"iops"`
109112

113+
// Throughput to provision in MiB/s supported for the volume type. This
114+
// is currently only applicable to volumes of type gp3.
115+
//
116+
// +kubebuilder:validation:Minimum=0
117+
// +optional
118+
Throughput int64 `json:"throughput"`
119+
110120
// Size defines the size of the volume in gibibytes (GiB).
111121
//
112122
// +kubebuilder:validation:Minimum=0

pkg/types/aws/validation/machinepool.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func ValidateMachinePool(platform *aws.Platform, p *aws.MachinePool, fldPath *fi
4646
if p.EC2RootVolume.Type != "" {
4747
allErrs = append(allErrs, validateVolumeSize(p, fldPath)...)
4848
allErrs = append(allErrs, validateIOPS(p, fldPath)...)
49+
allErrs = append(allErrs, validateThroughput(p, fldPath)...)
4950
}
5051

5152
if p.EC2Metadata.Authentication != "" && !validMetadataAuthValues.Has(p.EC2Metadata.Authentication) {
@@ -108,6 +109,25 @@ func validateIOPS(p *aws.MachinePool, fldPath *field.Path) field.ErrorList {
108109
return allErrs
109110
}
110111

112+
func validateThroughput(p *aws.MachinePool, fldPath *field.Path) field.ErrorList {
113+
allErrs := field.ErrorList{}
114+
volumeType := strings.ToLower(p.EC2RootVolume.Type)
115+
throughput := p.EC2RootVolume.Throughput
116+
117+
switch volumeType {
118+
case "gp3":
119+
if throughput != 0 && (throughput < 125 || throughput > 2000) {
120+
allErrs = append(allErrs, field.Invalid(fldPath.Child("throughput"), throughput, "throughput must be between 125 MiB/s and 2000 MiB/s"))
121+
}
122+
default:
123+
if throughput != 0 {
124+
allErrs = append(allErrs, field.Invalid(fldPath.Child("throughput"), throughput, fmt.Sprintf("throughput not supported for type %s", volumeType)))
125+
}
126+
}
127+
128+
return allErrs
129+
}
130+
111131
// ValidateAMIID check the AMI ID is set for a machine pool.
112132
func ValidateAMIID(platform *aws.Platform, p *aws.MachinePool, fldPath *field.Path) field.ErrorList {
113133
allErrs := field.ErrorList{}

0 commit comments

Comments
 (0)