@@ -232,8 +232,8 @@ def regions_with_offering(cls, instance_type: Optional[str],
232
232
if instance_type is None :
233
233
return regions
234
234
235
- autoscaler_type = kubernetes_utils .get_autoscaler_type ()
236
235
regions_to_return = []
236
+ autoscaler_type = kubernetes_utils .get_autoscaler_type ()
237
237
for r in regions :
238
238
context = r .name
239
239
try :
@@ -244,18 +244,20 @@ def regions_with_offering(cls, instance_type: Optional[str],
244
244
continue
245
245
if fits :
246
246
regions_to_return .append (r )
247
+ continue
248
+ debug_msg = (f'Instance type { instance_type } does '
249
+ 'not fit in the Kubernetes cluster '
250
+ 'with context: '
251
+ f'{ context } . Reason: { reason } ' )
252
+ if autoscaler_type is None :
253
+ logger .debug (debug_msg )
254
+ continue
255
+ autoscaler = kubernetes_utils .get_autoscaler (autoscaler_type )
256
+ if autoscaler .can_create_new_instance_of_type (
257
+ context , instance_type ):
258
+ regions_to_return .append (r )
247
259
else :
248
- if autoscaler_type is not None :
249
- autoscaler = kubernetes_utils . \
250
- get_autoscaler (autoscaler_type )
251
- if autoscaler .can_create_new_instance_of_type (
252
- context , instance_type ):
253
- regions_to_return .append (r )
254
- else :
255
- logger .debug (f'Instance type { instance_type } does '
256
- 'not fit in the Kubernetes cluster '
257
- 'with context: '
258
- f'{ context } . Reason: { reason } ' )
260
+ logger .debug (debug_msg )
259
261
return regions_to_return
260
262
261
263
def instance_type_to_hourly_cost (self ,
0 commit comments