Use SSD as default volume type.

General purpose SSD ('gp2') volume type is just slighly more expensive than
Magnetic ('standard' / default in AWS), while the performance gain is pretty
significant.

So far, the volumes were created only during testing, where the extra cost
won't make any difference. In future, we plan to introduce QoS classes, where
users could choose SSD/Magnetic depending on their use cases.

'gp2' is just the default volume type for (hopefuly) short period before these
QoS classes are implemented.
This commit is contained in:
Jan Safranek 2015-12-14 15:44:08 +01:00
parent 6ff5286df9
commit 1b7445a6e2

View File

@ -58,6 +58,11 @@ const TagNameKubernetesCluster = "KubernetesCluster"
// MaxReadThenCreateRetries sets the maximum number of attempts we will make
const MaxReadThenCreateRetries = 30
// Default volume type for newly created Volumes
// TODO: Remove when user/admin can configure volume types and thus we don't
// need hardcoded defaults.
const DefaultVolumeType = "gp2"
// Abstraction over AWS, to allow mocking/other implementations
type AWSServices interface {
Compute(region string) (EC2, error)
@ -1219,12 +1224,12 @@ func (aws *AWSCloud) DetachDisk(instanceName string, diskName string) error {
// Implements Volumes.CreateVolume
func (s *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error) {
// TODO: Should we tag this with the cluster id (so it gets deleted when the cluster does?)
// This is only used for testing right now
request := &ec2.CreateVolumeInput{}
request.AvailabilityZone = &s.availabilityZone
volSize := int64(volumeOptions.CapacityGB)
request.Size = &volSize
request.VolumeType = aws.String(DefaultVolumeType)
response, err := s.ec2.CreateVolume(request)
if err != nil {
return "", err