Browse Source

Merge "Rename aws flavor-name to instance-type"

tags/3.5.0
Zuul 9 months ago
parent
commit
9c7843d28a
5 changed files with 14 additions and 14 deletions
  1. +4
    -4
      doc/source/configuration.rst
  2. +4
    -4
      nodepool/driver/aws/config.py
  3. +4
    -4
      nodepool/driver/aws/provider.py
  4. +1
    -1
      nodepool/tests/fixtures/aws.yaml
  5. +1
    -1
      nodepool/tests/fixtures/config_validate/good.yaml

+ 4
- 4
doc/source/configuration.rst View File

@@ -1347,11 +1347,11 @@ section of the configuration.
labels:
- name: debian9
cloud-image: debian9
flavor-name: t3.medium
instance-type: t3.medium
key-name: zuul
- name: debian9-large
cloud-image: debian9
flavor-name: t3.large
instance-type: t3.large
key-name: zuul

.. attr:: name
@@ -1484,7 +1484,7 @@ section of the configuration.

labels:
- name: bionic
flavor-name: m5a.large
instance-type: m5a.large
console-log: True

Each entry is a dictionary with the following keys
@@ -1505,7 +1505,7 @@ section of the configuration.
configured entry from the ``cloud-images`` section of the
provider. See :attr:`providers.[aws].cloud-images`.

.. attr:: flavor-name
.. attr:: instance-type
:type: str
:required:


+ 4
- 4
nodepool/driver/aws/config.py View File

@@ -51,7 +51,7 @@ class ProviderLabel(ConfigValue):
def __init__(self):
self.name = None
self.cloud_image = None
self.flavor_name = None
self.instance_type = None
self.key_name = None
self.volume_size = None
self.volume_type = None
@@ -64,7 +64,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.flavor_name == self.flavor_name
and other.instance_type == self.instance_type
and other.key_name == self.key_name
and other.volume_size == self.volume_size
and other.volume_type == self.volume_type)
@@ -116,7 +116,7 @@ class ProviderPool(ConfigPool):
else:
cloud_image = None
pl.cloud_image = cloud_image
pl.flavor_name = label['flavor-name']
pl.instance_type = label['instance-type']
pl.key_name = label['key-name']
pl.volume_type = label.get('volume-type')
pl.volume_size = label.get('volume-size')
@@ -204,7 +204,7 @@ class AwsProviderConfig(ProviderConfig):
pool_label = {
v.Required('name'): str,
v.Exclusive('cloud-image', 'label-image'): str,
v.Required('flavor-name'): str,
v.Required('instance-type'): str,
v.Required('key-name'): str,
'volume-type': str,
'volume-size': int

+ 4
- 4
nodepool/driver/aws/provider.py View File

@@ -107,13 +107,13 @@ class AwsProvider(Provider):
return True

def createInstance(self, label):
image_name = label.cloud_image.external_name
image_id = label.cloud_image.external_name
args = dict(
ImageId=image_name,
ImageId=image_id,
MinCount=1,
MaxCount=1,
KeyName=label.key_name,
InstanceType=label.flavor_name,
InstanceType=label.instance_type,
NetworkInterfaces=[{
'AssociatePublicIpAddress': True,
'DeviceIndex': 0}])
@@ -129,7 +129,7 @@ class AwsProvider(Provider):
# We might need to supply our own mapping before lauching the instance.
# We basically want to make sure DeleteOnTermination is true and be
# able to set the volume type and size.
image = self.getImage(image_name)
image = self.getImage(image_id)
# TODO: Flavors can also influence whether or not the VM spawns with a
# volume -- we basically need to ensure DeleteOnTermination is true
if hasattr(image, 'block_device_mappings'):

+ 1
- 1
nodepool/tests/fixtures/aws.yaml View File

@@ -22,5 +22,5 @@ providers:
labels:
- name: ubuntu1404
cloud-image: ubuntu1404
flavor-name: t3.medium
instance-type: t3.medium
key-name: zuul

+ 1
- 1
nodepool/tests/fixtures/config_validate/good.yaml View File

@@ -155,7 +155,7 @@ providers:
labels:
- name: centos-ami
cloud-image: centos-ami
flavor-name: t2.micro
instance-type: t2.micro
key-name: zuul
volume-type: gp2
volume-size: 80

Loading…
Cancel
Save