Browse Source

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

tags/3.5.0
Zuul 5 months ago
parent
commit
9c7843d28a

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

@@ -1347,11 +1347,11 @@ section of the configuration.
1347 1347
              labels:
1348 1348
                - name: debian9
1349 1349
                  cloud-image: debian9
1350
-                 flavor-name: t3.medium
1350
+                 instance-type: t3.medium
1351 1351
                  key-name: zuul
1352 1352
                - name: debian9-large
1353 1353
                  cloud-image: debian9
1354
-                 flavor-name: t3.large
1354
+                 instance-type: t3.large
1355 1355
                  key-name: zuul
1356 1356
 
1357 1357
    .. attr:: name
@@ -1484,7 +1484,7 @@ section of the configuration.
1484 1484
 
1485 1485
             labels:
1486 1486
               - name: bionic
1487
-                flavor-name: m5a.large
1487
+                instance-type: m5a.large
1488 1488
                 console-log: True
1489 1489
 
1490 1490
          Each entry is a dictionary with the following keys
@@ -1505,7 +1505,7 @@ section of the configuration.
1505 1505
               configured entry from the ``cloud-images`` section of the
1506 1506
               provider. See :attr:`providers.[aws].cloud-images`.
1507 1507
 
1508
-           .. attr:: flavor-name
1508
+           .. attr:: instance-type
1509 1509
               :type: str
1510 1510
               :required:
1511 1511
 

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

@@ -51,7 +51,7 @@ class ProviderLabel(ConfigValue):
51 51
     def __init__(self):
52 52
         self.name = None
53 53
         self.cloud_image = None
54
-        self.flavor_name = None
54
+        self.instance_type = None
55 55
         self.key_name = None
56 56
         self.volume_size = None
57 57
         self.volume_type = None
@@ -64,7 +64,7 @@ class ProviderLabel(ConfigValue):
64 64
             # since this causes recursive checks with ProviderPool.
65 65
             return (other.name == self.name
66 66
                     and other.cloud_image == self.cloud_image
67
-                    and other.flavor_name == self.flavor_name
67
+                    and other.instance_type == self.instance_type
68 68
                     and other.key_name == self.key_name
69 69
                     and other.volume_size == self.volume_size
70 70
                     and other.volume_type == self.volume_type)
@@ -116,7 +116,7 @@ class ProviderPool(ConfigPool):
116 116
             else:
117 117
                 cloud_image = None
118 118
             pl.cloud_image = cloud_image
119
-            pl.flavor_name = label['flavor-name']
119
+            pl.instance_type = label['instance-type']
120 120
             pl.key_name = label['key-name']
121 121
             pl.volume_type = label.get('volume-type')
122 122
             pl.volume_size = label.get('volume-size')
@@ -204,7 +204,7 @@ class AwsProviderConfig(ProviderConfig):
204 204
         pool_label = {
205 205
             v.Required('name'): str,
206 206
             v.Exclusive('cloud-image', 'label-image'): str,
207
-            v.Required('flavor-name'): str,
207
+            v.Required('instance-type'): str,
208 208
             v.Required('key-name'): str,
209 209
             'volume-type': str,
210 210
             'volume-size': int

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

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

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

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

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

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

Loading…
Cancel
Save