Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ spec:
(GiB).
minimum: 0
type: integer
throughput:
description: Throughput to provision in MiB/s supported
for the volume type. Not applicable to all types.
format: int64
minimum: 0
type: integer
type:
description: Type defines the type of the volume.
type: string
Expand Down Expand Up @@ -1661,6 +1667,12 @@ spec:
gibibytes (GiB).
minimum: 0
type: integer
throughput:
description: Throughput to provision in MiB/s supported
for the volume type. Not applicable to all types.
format: int64
minimum: 0
type: integer
type:
description: Type defines the type of the volume.
type: string
Expand Down Expand Up @@ -3041,6 +3053,12 @@ spec:
(GiB).
minimum: 0
type: integer
throughput:
description: Throughput to provision in MiB/s supported
for the volume type. Not applicable to all types.
format: int64
minimum: 0
type: integer
type:
description: Type defines the type of the volume.
type: string
Expand Down Expand Up @@ -4613,6 +4631,12 @@ spec:
(GiB).
minimum: 0
type: integer
throughput:
description: Throughput to provision in MiB/s supported
for the volume type. Not applicable to all types.
format: int64
minimum: 0
type: integer
type:
description: Type defines the type of the volume.
type: string
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/machines/aws/awsmachines.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func GenerateMachines(clusterID string, in *MachineInput) ([]*asset.RuntimeFile,
Size: int64(mpool.EC2RootVolume.Size),
Type: capa.VolumeType(mpool.EC2RootVolume.Type),
IOPS: int64(mpool.EC2RootVolume.IOPS),
Throughput: ptr.To(mpool.EC2RootVolume.Throughput),
Encrypted: ptr.To(true),
EncryptionKey: mpool.KMSKeyARN,
},
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/machines/aws/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func provider(in *machineProviderInput) (*machineapi.AWSMachineProviderConfig, e
VolumeType: pointer.String(in.root.Type),
VolumeSize: pointer.Int64(int64(in.root.Size)),
Iops: pointer.Int64(int64(in.root.IOPS)),
Throughput: pointer.Int64(int64(in.root.Throughput)),
Encrypted: pointer.Bool(true),
KMSKey: machineapi.AWSResourceReference{ARN: pointer.String(in.root.KMSKeyARN)},
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/tfvars/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Config struct {
EdgeZonesGatewayIndex map[string]int `json:"aws_edge_parent_zones_index,omitempty"`
EdgeZonesType map[string]string `json:"aws_edge_zones_type,omitempty"`
IOPS int64 `json:"aws_master_root_volume_iops"`
Throughput int64 `json:"aws_master_root_volume_throughput"`
Size int64 `json:"aws_master_root_volume_size,omitempty"`
Type string `json:"aws_master_root_volume_type,omitempty"`
Encrypted bool `json:"aws_master_root_volume_encrypted"`
Expand Down Expand Up @@ -244,6 +245,9 @@ func TFVars(sources TFVarsSources) ([]byte, error) {
if rootVolume.EBS.Iops != nil {
cfg.IOPS = *rootVolume.EBS.Iops
}
if rootVolume.EBS.Throughput != nil {
cfg.Throughput = *rootVolume.EBS.Throughput
}

cfg.Encrypted = true
if rootVolume.EBS.Encrypted != nil {
Expand Down
9 changes: 9 additions & 0 deletions pkg/types/aws/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (a *MachinePool) Set(required *MachinePool) {
if required.EC2RootVolume.IOPS != 0 {
a.EC2RootVolume.IOPS = required.EC2RootVolume.IOPS
}
if required.EC2RootVolume.Throughput != 0 {
a.EC2RootVolume.Throughput = required.EC2RootVolume.Throughput
}
if required.EC2RootVolume.Size != 0 {
a.EC2RootVolume.Size = required.EC2RootVolume.Size
}
Expand Down Expand Up @@ -107,6 +110,12 @@ type EC2RootVolume struct {
// +optional
IOPS int `json:"iops"`

// Throughput to provision in MiB/s supported for the volume type. Not applicable to all types.
//
// +kubebuilder:validation:Minimum=0
// +optional
Throughput int64 `json:"throughput"`

// Size defines the size of the volume in gibibytes (GiB).
//
// +kubebuilder:validation:Minimum=0
Expand Down
20 changes: 20 additions & 0 deletions pkg/types/aws/validation/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func ValidateMachinePool(platform *aws.Platform, p *aws.MachinePool, fldPath *fi
if p.EC2RootVolume.Type != "" {
allErrs = append(allErrs, validateVolumeSize(p, fldPath)...)
allErrs = append(allErrs, validateIOPS(p, fldPath)...)
allErrs = append(allErrs, validateThroughput(p, fldPath)...)
}

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

func validateThroughput(p *aws.MachinePool, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
volumeType := strings.ToLower(p.EC2RootVolume.Type)
throughput := p.EC2RootVolume.Throughput

switch volumeType {
case "gp3":
if throughput < 125 || throughput > 2000 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("throughput"), throughput, "throughput must be between 125 MiB/s and 1000 MiB/s"))
}
default:
if throughput != 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("throughput"), throughput, fmt.Sprintf("throughput not supported for type %s", volumeType)))
}
}

return allErrs
}

// ValidateAMIID check the AMI ID is set for a machine pool.
func ValidateAMIID(platform *aws.Platform, p *aws.MachinePool, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
Expand Down