-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CORS-4212: AWS: Add the ability to configure throughput on GP3 volumes #9945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"` | ||
|
@@ -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 | ||
} | ||
Comment on lines
+248
to
+250
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto, I don't think we need this terraform update. |
||
|
||
cfg.Encrypted = true | ||
if rootVolume.EBS.Encrypted != nil { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
} | ||||||
|
@@ -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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// | ||||||
// +kubebuilder:validation:Minimum=0 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the minimum is listing as 0, but we validate the minimum as 125, so it seems like the minimum here should be set to 125 and also the maximum should be set as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A non-zero value will break things. This setting is only valid for gp3 volumes. While I don't know the behavior from Amazon that this would cause, I do know that cluter-api-provider-aws will blow up: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We handle IOPS in a similar fashion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
// +optional | ||||||
Throughput int64 `json:"throughput"` | ||||||
|
||||||
// Size defines the size of the volume in gibibytes (GiB). | ||||||
// | ||||||
// +kubebuilder:validation:Minimum=0 | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
|
@@ -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": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @patrickdillon @jhixson74 should we allow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mtulio according to documentation in the code, this is only supported by gp3. If you can show otherwise, I'm happy to update. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://docs.aws.amazon.com/cli/latest/reference/ec2/create-volume.html Scroll down to --throughput Only gp3 is supported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, I messed up with iops |
||
if throughput < 125 || throughput > 1000 { | ||
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{} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this change. AFAIK AWS is not using the Terraform configs (a few providers get information from the terraform configs in the capi workflows, but I don't think AWS is one of those. correct me if I'm wrong). We will delete them to avoid future confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove. Why does this code still exist if we aren't using it?