Skip to content

Commit e81ba7f

Browse files
Merge pull request #9945 from jhixson74/main_aws_gp3_throughput
CORS-4212: AWS: Add the ability to configure throughput on GP3 volumes
2 parents 5060ac9 + 2e5a20b commit e81ba7f

File tree

18 files changed

+232
-21
lines changed

18 files changed

+232
-21
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ spec:
249249
(GiB).
250250
minimum: 0
251251
type: integer
252+
throughput:
253+
description: |-
254+
Throughput to provision in MiB/s supported for the volume type. This
255+
is currently only applicable to volumes of type gp3.
256+
format: int64
257+
minimum: 0
258+
type: integer
252259
type:
253260
description: Type defines the type of the volume.
254261
type: string
@@ -1795,6 +1802,13 @@ spec:
17951802
gibibytes (GiB).
17961803
minimum: 0
17971804
type: integer
1805+
throughput:
1806+
description: |-
1807+
Throughput to provision in MiB/s supported for the volume type. This
1808+
is currently only applicable to volumes of type gp3.
1809+
format: int64
1810+
minimum: 0
1811+
type: integer
17981812
type:
17991813
description: Type defines the type of the volume.
18001814
type: string
@@ -3281,6 +3295,13 @@ spec:
32813295
(GiB).
32823296
minimum: 0
32833297
type: integer
3298+
throughput:
3299+
description: |-
3300+
Throughput to provision in MiB/s supported for the volume type. This
3301+
is currently only applicable to volumes of type gp3.
3302+
format: int64
3303+
minimum: 0
3304+
type: integer
32843305
type:
32853306
description: Type defines the type of the volume.
32863307
type: string
@@ -4960,6 +4981,13 @@ spec:
49604981
(GiB).
49614982
minimum: 0
49624983
type: integer
4984+
throughput:
4985+
description: |-
4986+
Throughput to provision in MiB/s supported for the volume type. This
4987+
is currently only applicable to volumes of type gp3.
4988+
format: int64
4989+
minimum: 0
4990+
type: integer
49634991
type:
49644992
description: Type defines the type of the volume.
49654993
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

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ require (
8484
github.com/nutanix-cloud-native/cluster-api-provider-nutanix v1.7.0
8585
github.com/nutanix-cloud-native/prism-go-client v0.5.0
8686
github.com/onsi/gomega v1.38.2
87-
github.com/openshift/api v0.0.0-20251117165054-348370f055bf
87+
github.com/openshift/api v0.0.0-20251120220512-cb382c9eaf42
8888
github.com/openshift/assisted-image-service v0.0.0-20240607085136-02df2e56dde6
8989
github.com/openshift/assisted-service/api v0.0.0
9090
github.com/openshift/assisted-service/client v0.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,8 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ
701701
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
702702
github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk=
703703
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
704-
github.com/openshift/api v0.0.0-20251117165054-348370f055bf h1:8VzLlQFneh4bnHA3SS+Bb9VWdVaR7WugtSeqIngMC3s=
705-
github.com/openshift/api v0.0.0-20251117165054-348370f055bf/go.mod h1:d5uzF0YN2nQQFA0jIEWzzOZ+edmo6wzlGLvx5Fhz4uY=
704+
github.com/openshift/api v0.0.0-20251120220512-cb382c9eaf42 h1:Mo2FlDdoCZ+BE2W4C0lNcxEDeIIhfsYFP6vj4Sggp8w=
705+
github.com/openshift/api v0.0.0-20251120220512-cb382c9eaf42/go.mod h1:d5uzF0YN2nQQFA0jIEWzzOZ+edmo6wzlGLvx5Fhz4uY=
706706
github.com/openshift/assisted-image-service v0.0.0-20240607085136-02df2e56dde6 h1:U6ve+dnHlHhAELoxX+rdFOHVhoaYl0l9qtxwYtsO6C0=
707707
github.com/openshift/assisted-image-service v0.0.0-20240607085136-02df2e56dde6/go.mod h1:o2H5VwQhUD8P6XsK6dRmKpCCJqVvv12KJQZBXmcCXCU=
708708
github.com/openshift/assisted-service/api v0.0.0-20250922204150-a52b83145bea h1:YhJ9iHKKT5ooAdVr8qq3BdudhTxP/WF0XYDT5gzi1ak=

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
@@ -242,11 +242,12 @@ func provider(in *machineProviderInput) (*machineapi.AWSMachineProviderConfig, e
242242
BlockDevices: []machineapi.BlockDeviceMappingSpec{
243243
{
244244
EBS: &machineapi.EBSBlockDeviceSpec{
245-
VolumeType: pointer.String(in.root.Type),
246-
VolumeSize: pointer.Int64(int64(in.root.Size)),
247-
Iops: pointer.Int64(int64(in.root.IOPS)),
248-
Encrypted: pointer.Bool(true),
249-
KMSKey: machineapi.AWSResourceReference{ARN: pointer.String(in.root.KMSKeyARN)},
245+
VolumeType: pointer.String(in.root.Type),
246+
VolumeSize: pointer.Int64(int64(in.root.Size)),
247+
Iops: pointer.Int64(int64(in.root.IOPS)),
248+
ThroughputMib: pointer.Int32(int32(in.root.Throughput)),
249+
Encrypted: pointer.Bool(true),
250+
KMSKey: machineapi.AWSResourceReference{ARN: pointer.String(in.root.KMSKeyARN)},
250251
},
251252
},
252253
},

pkg/types/aws/machinepool.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ func (a *MachinePool) Set(required *MachinePool) {
7979
if required.EC2RootVolume.IOPS != 0 {
8080
a.EC2RootVolume.IOPS = required.EC2RootVolume.IOPS
8181
}
82+
if required.EC2RootVolume.Throughput != 0 {
83+
a.EC2RootVolume.Throughput = required.EC2RootVolume.Throughput
84+
}
8285
if required.EC2RootVolume.Size != 0 {
8386
a.EC2RootVolume.Size = required.EC2RootVolume.Size
8487
}
@@ -119,6 +122,13 @@ type EC2RootVolume struct {
119122
// +optional
120123
IOPS int `json:"iops"`
121124

125+
// Throughput to provision in MiB/s supported for the volume type. This
126+
// is currently only applicable to volumes of type gp3.
127+
//
128+
// +kubebuilder:validation:Minimum=0
129+
// +optional
130+
Throughput int64 `json:"throughput"`
131+
122132
// Size defines the size of the volume in gibibytes (GiB).
123133
//
124134
// +kubebuilder:validation:Minimum=0

pkg/types/aws/validation/machinepool.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func ValidateMachinePool(platform *aws.Platform, p *aws.MachinePool, fldPath *fi
5151
if p.EC2RootVolume.Type != "" {
5252
allErrs = append(allErrs, validateVolumeSize(p, fldPath)...)
5353
allErrs = append(allErrs, validateIOPS(p, fldPath)...)
54+
allErrs = append(allErrs, validateThroughput(p, fldPath)...)
5455
}
5556

5657
if p.EC2Metadata.Authentication != "" && !validMetadataAuthValues.Has(p.EC2Metadata.Authentication) {
@@ -114,6 +115,25 @@ func validateIOPS(p *aws.MachinePool, fldPath *field.Path) field.ErrorList {
114115
return allErrs
115116
}
116117

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

vendor/github.com/openshift/api/config/v1/types_node.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)