mirror of https://github.com/kubernetes/kops.git
- fixing up the iops issue, masking when not required i.e. when the volume type is not io1 for now
This commit is contained in:
parent
a21ec01f3b
commit
0bd9126387
|
|
@ -135,8 +135,12 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
if x.Type == "" {
|
||||
x.Type = DefaultVolumeType
|
||||
}
|
||||
if x.Iops == nil && x.Type == ec2.VolumeTypeIo1 {
|
||||
x.Iops = fi.Int64(DefaultVolumeIops)
|
||||
if x.Type == ec2.VolumeTypeIo1 {
|
||||
if x.Iops == nil {
|
||||
x.Iops = fi.Int64(DefaultVolumeIops)
|
||||
}
|
||||
} else {
|
||||
x.Iops = nil
|
||||
}
|
||||
t.BlockDeviceMappings = append(t.BlockDeviceMappings, &awstasks.BlockDeviceMapping{
|
||||
DeviceName: fi.String(x.Device),
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ func BlockDeviceMappingFromEC2(i *ec2.BlockDeviceMapping) (string, *BlockDeviceM
|
|||
if i.Ebs != nil {
|
||||
o.EbsDeleteOnTermination = i.Ebs.DeleteOnTermination
|
||||
o.EbsEncrypted = i.Ebs.Encrypted
|
||||
o.EbsVolumeIops = i.Ebs.Iops
|
||||
o.EbsVolumeSize = i.Ebs.VolumeSize
|
||||
o.EbsVolumeType = i.Ebs.VolumeType
|
||||
}
|
||||
|
|
@ -64,13 +65,16 @@ func (i *BlockDeviceMapping) ToEC2(deviceName string) *ec2.BlockDeviceMapping {
|
|||
DeviceName: aws.String(deviceName),
|
||||
VirtualName: i.VirtualName,
|
||||
}
|
||||
if i.EbsDeleteOnTermination != nil || i.EbsVolumeSize != nil || i.EbsVolumeType != nil {
|
||||
if i.EbsDeleteOnTermination != nil || i.EbsVolumeSize != nil || i.EbsVolumeType != nil || i.EbsVolumeIops != nil {
|
||||
o.Ebs = &ec2.EbsBlockDevice{
|
||||
DeleteOnTermination: i.EbsDeleteOnTermination,
|
||||
Encrypted: i.EbsEncrypted,
|
||||
VolumeSize: i.EbsVolumeSize,
|
||||
VolumeType: i.EbsVolumeType,
|
||||
}
|
||||
if fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo1 {
|
||||
o.Ebs.Iops = i.EbsVolumeIops
|
||||
}
|
||||
}
|
||||
|
||||
return o
|
||||
|
|
@ -87,6 +91,10 @@ func BlockDeviceMappingFromAutoscaling(i *autoscaling.BlockDeviceMapping) (strin
|
|||
o.EbsEncrypted = i.Ebs.Encrypted
|
||||
o.EbsVolumeSize = i.Ebs.VolumeSize
|
||||
o.EbsVolumeType = i.Ebs.VolumeType
|
||||
|
||||
if fi.StringValue(o.EbsVolumeType) == ec2.VolumeTypeIo1 {
|
||||
o.EbsVolumeIops = i.Ebs.Iops
|
||||
}
|
||||
}
|
||||
|
||||
return aws.StringValue(i.DeviceName), o
|
||||
|
|
@ -106,6 +114,9 @@ func (i *BlockDeviceMapping) ToAutoscaling(deviceName string) *autoscaling.Block
|
|||
VolumeType: i.EbsVolumeType,
|
||||
Iops: i.EbsVolumeIops,
|
||||
}
|
||||
if fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo1 {
|
||||
o.Ebs.Iops = i.EbsVolumeIops
|
||||
}
|
||||
}
|
||||
|
||||
return o
|
||||
|
|
|
|||
Loading…
Reference in New Issue