Add iops field for gp3 volumes only with launch templates

This commit is contained in:
Ciprian Hacman 2021-01-21 10:53:43 +02:00
parent 3b24a11b30
commit 85fbf1c6a2
1 changed files with 6 additions and 7 deletions

View File

@ -160,7 +160,12 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
} else {
lt.RootVolumeKmsKey = fi.String("")
}
if fi.StringValue(ig.Spec.RootVolumeType) == ec2.VolumeTypeGp3 {
if fi.StringValue(lt.RootVolumeType) == ec2.VolumeTypeGp3 {
if fi.Int32Value(ig.Spec.RootVolumeIops) < 3000 {
lt.RootVolumeIops = fi.Int64(int64(DefaultVolumeGp3Iops))
} else {
lt.RootVolumeIops = fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeIops)))
}
if fi.Int32Value(ig.Spec.RootVolumeThroughput) < 125 {
lt.RootVolumeThroughput = fi.Int64(int64(DefaultVolumeGp3Throughput))
} else {
@ -259,12 +264,6 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchConfigurationTask(c *fi.ModelB
} else {
t.RootVolumeIops = fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeIops)))
}
} else if volumeType == ec2.VolumeTypeGp3 {
if fi.Int32Value(ig.Spec.RootVolumeIops) < 3000 {
t.RootVolumeIops = fi.Int64(int64(DefaultVolumeGp3Iops))
} else {
t.RootVolumeIops = fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeIops)))
}
}
if ig.Spec.Tenancy != "" {