add ebs-optimized support for aws provider
Change-Id: I1f6330a71b85f23e6fbe3abd636764e5f3b8a61d
This commit is contained in:
parent
79388c2be8
commit
5bae6272f4
@ -1800,6 +1800,14 @@ section of the configuration.
|
||||
configured entry from the ``cloud-images`` section of the
|
||||
provider. See :attr:`providers.[aws].cloud-images`.
|
||||
|
||||
.. attr:: ebs-optimized
|
||||
:type: bool
|
||||
:default: False
|
||||
|
||||
Indicates whether EBS optimization
|
||||
(additional, dedicated throughput between Amazon EC2 and Amazon EBS,)
|
||||
has been enabled for the instance.
|
||||
|
||||
.. attr:: instance-type
|
||||
:type: str
|
||||
:required:
|
||||
|
@ -52,6 +52,7 @@ class ProviderLabel(ConfigValue):
|
||||
def __init__(self):
|
||||
self.name = None
|
||||
self.cloud_image = None
|
||||
self.ebs_optimized = None
|
||||
self.instance_type = None
|
||||
self.key_name = None
|
||||
self.volume_size = None
|
||||
@ -67,6 +68,7 @@ class ProviderLabel(ConfigValue):
|
||||
# since this causes recursive checks with ProviderPool.
|
||||
return (other.name == self.name
|
||||
and other.cloud_image == self.cloud_image
|
||||
and other.ebs_optimized == self.ebs_optimized
|
||||
and other.instance_type == self.instance_type
|
||||
and other.key_name == self.key_name
|
||||
and other.volume_size == self.volume_size
|
||||
@ -123,6 +125,7 @@ class ProviderPool(ConfigPool):
|
||||
else:
|
||||
cloud_image = None
|
||||
pl.cloud_image = cloud_image
|
||||
pl.ebs_optimized = bool(label.get('ebs-optimized', False))
|
||||
pl.instance_type = label['instance-type']
|
||||
pl.key_name = label['key-name']
|
||||
pl.volume_type = label.get('volume-type')
|
||||
@ -236,6 +239,7 @@ class AwsProviderConfig(ProviderConfig):
|
||||
v.Exclusive('cloud-image', 'label-image'): str,
|
||||
v.Required('instance-type'): str,
|
||||
v.Required('key-name'): str,
|
||||
'ebs-optimized': bool,
|
||||
'volume-type': str,
|
||||
'volume-size': int,
|
||||
'userdata': str,
|
||||
|
@ -167,6 +167,7 @@ class AwsProvider(Provider):
|
||||
MinCount=1,
|
||||
MaxCount=1,
|
||||
KeyName=label.key_name,
|
||||
EbsOptimized=label.ebs_optimized,
|
||||
InstanceType=label.instance_type,
|
||||
NetworkInterfaces=[{
|
||||
'AssociatePublicIpAddress': label.pool.public_ip,
|
||||
|
13
nodepool/tests/fixtures/aws.yaml
vendored
13
nodepool/tests/fixtures/aws.yaml
vendored
@ -9,6 +9,7 @@ labels:
|
||||
- name: ubuntu1404-by-filters
|
||||
- name: ubuntu1404-by-capitalized-filters
|
||||
- name: ubuntu1404-bad-config
|
||||
- name: ubuntu1404-ebs-optimized
|
||||
- name: ubuntu1404-non-host-key-checking
|
||||
- name: ubuntu1404-private-ip
|
||||
- name: ubuntu1404-userdata
|
||||
@ -45,6 +46,16 @@ providers:
|
||||
- ubuntu*
|
||||
username: ubuntu
|
||||
pools:
|
||||
- name: ebs-optimized
|
||||
max-servers: 1
|
||||
subnet-id: null
|
||||
security-group-id: null
|
||||
labels:
|
||||
- name: ubuntu1404-ebs-optimized
|
||||
cloud-image: ubuntu1404
|
||||
ebs-optimized: True
|
||||
instance-type: t3.medium
|
||||
key-name: zuul
|
||||
- name: main
|
||||
max-servers: 1
|
||||
subnet-id: null
|
||||
@ -105,4 +116,4 @@ providers:
|
||||
instance-type: t3.medium
|
||||
key-name: zuul
|
||||
tags:
|
||||
has-tags: true
|
||||
has-tags: true
|
@ -88,6 +88,8 @@ class TestDriverAws(tests.DBTestCase):
|
||||
raw_config['providers'][0]['pools'][2]['security-group-id'] = sg_id
|
||||
raw_config['providers'][0]['pools'][3]['subnet-id'] = subnet_id
|
||||
raw_config['providers'][0]['pools'][3]['security-group-id'] = sg_id
|
||||
raw_config['providers'][0]['pools'][4]['subnet-id'] = subnet_id
|
||||
raw_config['providers'][0]['pools'][4]['security-group-id'] = sg_id
|
||||
|
||||
with tempfile.NamedTemporaryFile() as tf:
|
||||
tf.write(yaml.safe_dump(
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add optional ebs-optimized on ec2 instances.
|
Loading…
Reference in New Issue
Block a user