Skip to content

Commit

Permalink
Add size and type support for aws volumes
Browse files Browse the repository at this point in the history
Since we added support on the aws actuator API openshift/cluster-api-provider-aws#132 we want to allow this to be configurable for the users through the upper level installer API config
  • Loading branch information
enxebre committed Jan 16, 2019
1 parent 61482d2 commit 9ba64ee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/asset/machines/aws/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@ func provider(clusterID, clusterName string, platform *aws.Platform, mpool *aws.
APIVersion: "awsproviderconfig.k8s.io/v1alpha1",
Kind: "AWSMachineProviderConfig",
},
InstanceType: mpool.InstanceType,
InstanceType: mpool.InstanceType,
BlockDevices: []awsprovider.BlockDeviceMappingSpec{
{
EBS: &awsprovider.EBSBlockDeviceSpec{
VolumeType: pointer.StringPtr(mpool.Type),
VolumeSize: pointer.Int64Ptr(int64(mpool.Size)),
Iops: pointer.Int64Ptr(int64(mpool.IOPS)),
},
},
},
AMI: awsprovider.AWSResourceReference{ID: &amiID},
Tags: tags,
IAMInstanceProfile: &awsprovider.AWSResourceReference{ID: pointer.StringPtr(fmt.Sprintf("%s-%s-profile", clusterName, role))},
Expand Down
2 changes: 2 additions & 0 deletions pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ func (m *Master) Generate(dependencies asset.Parents) error {
switch ic.Platform.Name() {
case awstypes.Name:
mpool := defaultAWSMachinePoolPlatform()
// master pool default volume settings
mpool.EC2RootVolume.Size = 120
mpool.Set(ic.Platform.AWS.DefaultMachinePlatform)
mpool.Set(pool.Platform.AWS)
if len(mpool.Zones) == 0 {
Expand Down
9 changes: 9 additions & 0 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
func defaultAWSMachinePoolPlatform() awstypes.MachinePool {
return awstypes.MachinePool{
InstanceType: "m4.large",
EC2RootVolume: awstypes.EC2RootVolume{
Type: "gp2",
Size: 32,
},
}
}

Expand Down Expand Up @@ -94,6 +98,11 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
switch ic.Platform.Name() {
case awstypes.Name:
mpool := defaultAWSMachinePoolPlatform()
// worker pool default volume settings
mpool.EC2RootVolume = awstypes.EC2RootVolume{
Type: "gp2",
Size: 32,
}
mpool.Set(ic.Platform.AWS.DefaultMachinePlatform)
mpool.Set(pool.Platform.AWS)
if len(mpool.Zones) == 0 {
Expand Down

0 comments on commit 9ba64ee

Please sign in to comment.