Skip to content

Commit

Permalink
Fix rootVolumeType accepts all volume types kubernetes#4256
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 committed Jan 14, 2018
1 parent 2c80c0e commit e4c9bdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/instance_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The default volume size for Masters is 64 GB, while the default volume size for
The procedure to resize the root volume works the same way:

* Edit the instance group, set `rootVolumeSize` and/or `rootVolumeType` to the desired values: `kops edit ig nodes`
* `rootVolumeType` must be one of [supported volume types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html), e.g. `gp2` (default), `io1` (high performance) or `standard` (for testing).
* If `rootVolumeType` is set to `io1` then you can define the number of Iops by specifing `rootVolumeIops` (defaults to 100 if not defined)
* Preview changes: `kops update cluster <clustername>`
* Apply changes: `kops update cluster <clustername> --yes`
Expand Down
15 changes: 7 additions & 8 deletions pkg/model/awsmodel/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,17 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.ModelBuilderContext) error {
return err
}
}
volumeType := fi.StringValue(ig.Spec.RootVolumeType)
volumeIops := fi.Int32Value(ig.Spec.RootVolumeIops)

switch volumeType {
case "io1":
if volumeIops == 0 {
volumeIops = DefaultVolumeIops
}
default:
volumeType := fi.StringValue(ig.Spec.RootVolumeType)
if volumeType == "" {
volumeType = DefaultVolumeType
}

volumeIops := fi.Int32Value(ig.Spec.RootVolumeIops)
if volumeIops == 0 {
volumeIops = DefaultVolumeIops
}

t := &awstasks.LaunchConfiguration{
Name: s(name),
Lifecycle: b.Lifecycle,
Expand Down

0 comments on commit e4c9bdc

Please sign in to comment.