@@ -16,16 +16,14 @@ limitations under the License.
1616package aws
1717
1818import (
19- "strings"
20-
2119 "github.com/aws/aws-sdk-go/aws"
2220 "github.com/aws/aws-sdk-go/service/autoscaling"
2321 "github.com/aws/aws-sdk-go/service/ec2"
2422 "github.com/aws/aws-sdk-go/service/eks"
2523 "github.com/keikoproj/instance-manager/controllers/common"
2624)
2725
28- func (w * AwsWorker ) GetAutoScalingBasicBlockDevice (name , volType , snapshot string , volSize , iops int64 , delete , encrypt * bool ) * autoscaling.BlockDeviceMapping {
26+ func (w * AwsWorker ) GetAutoScalingBasicBlockDevice (name , volType , snapshot string , volSize , iops int64 , throughput int64 , delete , encrypt * bool ) * autoscaling.BlockDeviceMapping {
2927 device := & autoscaling.BlockDeviceMapping {
3028 DeviceName : aws .String (name ),
3129 Ebs : & autoscaling.Ebs {
@@ -40,20 +38,22 @@ func (w *AwsWorker) GetAutoScalingBasicBlockDevice(name, volType, snapshot strin
4038 if encrypt != nil {
4139 device .Ebs .Encrypted = encrypt
4240 }
43- if iops != 0 && strings . EqualFold ( volType , "io1" ) {
41+ if iops != 0 && common . ContainsEqualFold ( AllowedVolumeTypesWithProvisionedIOPS , volType ) {
4442 device .Ebs .Iops = aws .Int64 (iops )
4543 }
44+ if throughput != 0 && common .ContainsEqualFold (AllowedVolumeTypesWithProvisionedThroughput , volType ) {
45+ device .Ebs .Throughput = aws .Int64 (throughput )
46+ }
4647 if volSize != 0 {
4748 device .Ebs .VolumeSize = aws .Int64 (volSize )
4849 }
4950 if ! common .StringEmpty (snapshot ) {
5051 device .Ebs .SnapshotId = aws .String (snapshot )
5152 }
52-
5353 return device
5454}
5555
56- func (w * AwsWorker ) GetLaunchTemplateBlockDeviceRequest (name , volType , snapshot string , volSize , iops int64 , delete , encrypt * bool ) * ec2.LaunchTemplateBlockDeviceMappingRequest {
56+ func (w * AwsWorker ) GetLaunchTemplateBlockDeviceRequest (name , volType , snapshot string , volSize , iops int64 , throughput int64 , delete , encrypt * bool ) * ec2.LaunchTemplateBlockDeviceMappingRequest {
5757 device := & ec2.LaunchTemplateBlockDeviceMappingRequest {
5858 DeviceName : aws .String (name ),
5959 Ebs : & ec2.LaunchTemplateEbsBlockDeviceRequest {
@@ -68,9 +68,12 @@ func (w *AwsWorker) GetLaunchTemplateBlockDeviceRequest(name, volType, snapshot
6868 if encrypt != nil {
6969 device .Ebs .Encrypted = encrypt
7070 }
71- if iops != 0 && strings . EqualFold ( volType , "io1" ) {
71+ if iops != 0 && common . ContainsEqualFold ( AllowedVolumeTypesWithProvisionedIOPS , volType ) {
7272 device .Ebs .Iops = aws .Int64 (iops )
7373 }
74+ if throughput != 0 && common .ContainsEqualFold (AllowedVolumeTypesWithProvisionedThroughput , volType ) {
75+ device .Ebs .Throughput = aws .Int64 (throughput )
76+ }
7477 if volSize != 0 {
7578 device .Ebs .VolumeSize = aws .Int64 (volSize )
7679 }
0 commit comments