Skip to content

Commit

Permalink
feat(ec2): Add Throughput to EBSBlockDevice
Browse files Browse the repository at this point in the history
Newer generation EBS block devices allow passing in a throughput
parameter similar to IOPs. This adds that field to EBSBlockDevice and
pipes it through to the AWS API request similar to IOPs.

Signed-off-by: justin.miron <[email protected]>
Signed-off-by: Maximilian Blatt (external expert on behalf of DB Netz) <[email protected]>

Co-authored-by: Maximilian Blatt (external expert on behalf of DB Netz) <[email protected]>
(rebase and change to "Throughput")
  • Loading branch information
justinmir authored and ssuman2-infoblox committed Nov 4, 2023
1 parent d4f4788 commit 937ca7c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apis/ec2/manualv1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ type EBSBlockDevice struct {
// it is not used in requests to create gp2, st1, sc1, or standard volumes.
IOps *int32 `json:"iops,omitempty"`

// The throughput that the volume supports, in MiB/s.
//
// Constraints: Up to 1,000MiB/s for gp3 volumes.
//
// Condition: This parameter is optional and only used to create gp3 volumes;
// it is not used in requests to create gp2, st1, sc1, io1, or standard volumes.
Throughput *int32 `json:"throughput,omitempty"`

// Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed
// CMK under which the EBS volume is encrypted.
//
Expand Down
5 changes: 5 additions & 0 deletions apis/ec2/manualv1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions package/crds/ec2.aws.crossplane.io_instances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,15 @@ spec:
snapshotId:
description: The ID of the snapshot.
type: string
throughput:
description: "The throughput that the volume supports,
in MiB/s. \n Constraints: Up to 1,000MiB/s for gp3
volumes. \n Condition: This parameter is optional
and only used to create gp3 volumes; it is not used
in requests to create gp2, st1, sc1, io1, or standard
volumes."
format: int32
type: integer
volumeSize:
description: "The size of the volume, in GiB. \n Default:
If you're creating the volume from a snapshot and
Expand Down
1 change: 1 addition & 0 deletions pkg/clients/ec2/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func GenerateEC2BlockDeviceMappings(mappings []manualv1alpha1.BlockDeviceMapping
DeleteOnTermination: bm.EBS.DeleteOnTermination,
Encrypted: bm.EBS.Encrypted,
Iops: bm.EBS.IOps,
Throughput: bm.EBS.Throughput,
KmsKeyId: bm.EBS.KmsKeyID,
SnapshotId: bm.EBS.SnapshotID,
VolumeSize: bm.EBS.VolumeSize,
Expand Down
2 changes: 2 additions & 0 deletions pkg/clients/ec2/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ func TestGenerateEC2RunInstancesInput(t *testing.T) {
DeleteOnTermination: aws.Bool(false),
Encrypted: aws.Bool(false),
IOps: aws.Int32(1),
Throughput: aws.Int32(100),
KmsKeyID: aws.String(keyName),
SnapshotID: aws.String(snapshotID),
VolumeSize: aws.Int32(1),
Expand Down Expand Up @@ -723,6 +724,7 @@ func TestGenerateEC2RunInstancesInput(t *testing.T) {
DeleteOnTermination: aws.Bool(false),
Encrypted: aws.Bool(false),
Iops: aws.Int32(1),
Throughput: aws.Int32(100),
KmsKeyId: aws.String(keyName),
SnapshotId: aws.String(snapshotID),
VolumeSize: aws.Int32(1),
Expand Down

0 comments on commit 937ca7c

Please sign in to comment.