Browse Source

Merge "Remove unused fields from AWS driver"

tags/3.5.0
Zuul 6 months ago
parent
commit
81781d56bc
1 changed files with 2 additions and 41 deletions
  1. 2
    41
      nodepool/driver/aws/config.py

+ 2
- 41
nodepool/driver/aws/config.py View File

@@ -14,7 +14,6 @@
14 14
 # See the License for the specific language governing permissions and
15 15
 # limitations under the License.
16 16
 
17
-import math
18 17
 import voluptuous as v
19 18
 
20 19
 from nodepool.driver import ConfigPool
@@ -26,7 +25,6 @@ class ProviderCloudImage(ConfigValue):
26 25
     def __init__(self):
27 26
         self.name = None
28 27
         self.image_id = None
29
-        self.image_name = None
30 28
         self.username = None
31 29
         self.connection_type = None
32 30
         self.connection_port = None
@@ -35,7 +33,6 @@ class ProviderCloudImage(ConfigValue):
35 33
         if isinstance(other, ProviderCloudImage):
36 34
             return (self.name == other.name
37 35
                     and self.image_id == other.image_id
38
-                    and self.image_name == other.image_name
39 36
                     and self.username == other.username
40 37
                     and self.connection_type == other.connection_type
41 38
                     and self.connection_port == other.connection_port)
@@ -47,7 +44,7 @@ class ProviderCloudImage(ConfigValue):
47 44
     @property
48 45
     def external_name(self):
49 46
         '''Human readable version of external.'''
50
-        return self.image_id or self.image_name or self.name
47
+        return self.image_id or self.name
51 48
 
52 49
 
53 50
 class ProviderLabel(ConfigValue):
@@ -82,8 +79,6 @@ class ProviderPool(ConfigPool):
82 79
         self.name = None
83 80
         self.max_cores = None
84 81
         self.max_ram = None
85
-        self.ignore_provider_quota = False
86
-        self.availability_zone = None
87 82
         self.subnet_id = None
88 83
         self.security_group_id = None
89 84
         self.host_key_checking = True
@@ -99,11 +94,6 @@ class ProviderPool(ConfigPool):
99 94
         self.name = pool_config['name']
100 95
         self.provider = provider
101 96
 
102
-        self.max_cores = pool_config.get('max-cores', math.inf)
103
-        self.max_ram = pool_config.get('max-ram', math.inf)
104
-        self.ignore_provider_quota = pool_config.get(
105
-            'ignore-provider-quota', False)
106
-        self.availability_zone = pool_config.get('availability-zone')
107 97
         self.security_group_id = pool_config.get('security-group-id')
108 98
         self.subnet_id = pool_config.get('subnet-id')
109 99
         self.host_key_checking = bool(
@@ -138,11 +128,6 @@ class ProviderPool(ConfigPool):
138 128
             # since this causes recursive checks with OpenStackProviderConfig.
139 129
             return (super().__eq__(other)
140 130
                     and other.name == self.name
141
-                    and other.max_cores == self.max_cores
142
-                    and other.max_ram == self.max_ram
143
-                    and other.ignore_provider_quota == (
144
-                        self.ignore_provider_quota)
145
-                    and other.availability_zone == self.availability_zone
146 131
                     and other.subnet_id == self.subnet_id
147 132
                     and other.security_group_id == self.security_group_id
148 133
                     and other.host_key_checking == self.host_key_checking
@@ -159,13 +144,9 @@ class AwsProviderConfig(ProviderConfig):
159 144
         self.__pools = {}
160 145
         self.profile_name = None
161 146
         self.region_name = None
162
-        self.rate = None
163 147
         self.boot_timeout = None
164 148
         self.launch_retries = None
165
-        self.launch_timeout = None
166 149
         self.cloud_images = {}
167
-        self.hostname_format = None
168
-        self.image_name_format = None
169 150
         super().__init__(provider)
170 151
 
171 152
     def __eq__(self, other):
@@ -174,10 +155,8 @@ class AwsProviderConfig(ProviderConfig):
174 155
                     and other.profile_name == self.profile_name
175 156
                     and other.region_name == self.region_name
176 157
                     and other.pools == self.pools
177
-                    and other.rate == self.rate
178 158
                     and other.boot_timeout == self.boot_timeout
179 159
                     and other.launch_retries == self.launch_retries
180
-                    and other.launch_timeout == self.launch_timeout
181 160
                     and other.cloud_images == self.cloud_images)
182 161
         return False
183 162
 
@@ -196,18 +175,8 @@ class AwsProviderConfig(ProviderConfig):
196 175
     def load(self, config):
197 176
         self.profile_name = self.provider.get('profile-name')
198 177
         self.region_name = self.provider.get('region-name')
199
-        self.rate = float(self.provider.get('rate', 1.0))
200 178
         self.boot_timeout = self.provider.get('boot-timeout', 60)
201 179
         self.launch_retries = self.provider.get('launch-retries', 3)
202
-        self.launch_timeout = self.provider.get('launch-timeout', 3600)
203
-        self.hostname_format = self.provider.get(
204
-            'hostname-format',
205
-            '{label.name}-{provider.name}-{node.id}'
206
-        )
207
-        self.image_name_format = self.provider.get(
208
-            'image-name-format',
209
-            '{image_name}-{timestamp}'
210
-        )
211 180
 
212 181
         default_port_mapping = {
213 182
             'ssh': 22,
@@ -219,7 +188,6 @@ class AwsProviderConfig(ProviderConfig):
219 188
             i = ProviderCloudImage()
220 189
             i.name = image['name']
221 190
             i.image_id = image.get('image-id', None)
222
-            i.image_name = image.get('image-name', None)
223 191
             i.username = image.get('username', None)
224 192
             i.connection_type = image.get('connection-type', 'ssh')
225 193
             i.connection_port = image.get(
@@ -246,9 +214,6 @@ class AwsProviderConfig(ProviderConfig):
246 214
         pool.update({
247 215
             v.Required('name'): str,
248 216
             v.Required('labels'): [pool_label],
249
-            'max-cores': int,
250
-            'max-ram': int,
251
-            'availability-zone': str,
252 217
             'security-group-id': str,
253 218
             'subnet-id': str,
254 219
         })
@@ -257,8 +222,7 @@ class AwsProviderConfig(ProviderConfig):
257 222
             'name': str,
258 223
             'connection-type': str,
259 224
             'connection-port': int,
260
-            v.Exclusive('image-id', 'cloud-image-name-or-id'): str,
261
-            v.Exclusive('image-name', 'cloud-image-name-or-id'): str,
225
+            'image-id': str,
262 226
             'username': str,
263 227
         }
264 228
 
@@ -268,11 +232,8 @@ class AwsProviderConfig(ProviderConfig):
268 232
             v.Required('region-name'): str,
269 233
             'profile-name': str,
270 234
             'cloud-images': [provider_cloud_images],
271
-            'rate': v.Coerce(float),
272 235
             'hostname-format': str,
273
-            'image-name-format': str,
274 236
             'boot-timeout': int,
275
-            'launch-timeout': int,
276 237
             'launch-retries': int,
277 238
         })
278 239
         return v.Schema(provider)

Loading…
Cancel
Save