Skip to content

Commit

Permalink
Merge pull request #152 from GetSimpl/fix/service-placement-default-t…
Browse files Browse the repository at this point in the history
…o-spot

Fix/service placement default to spot
  • Loading branch information
rokibulislaam authored May 27, 2024
2 parents 88230e3 + eaf78a7 commit ab067cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cloudlift/config/environment_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ def _validate_changes(self, configuration):
"key_name": {"type": "string"},
"allocation_strategy": {"type": "string"},
"spot_instance_pools": {"type": "integer"},
"ecs_instance_default_lifecycle_type": {"type": "string"}
"ecs_instance_default_lifecycle_type": {
"type": "string",
"pattern": "^(spot|ondemand)$"
}
},
"required": [
"min_instances",
Expand Down
3 changes: 2 additions & 1 deletion cloudlift/deployment/service_template_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def _add_service(self, service_name, config):
if 'fargate' not in config:
for key in self.environment_stack["Outputs"]:
if key["OutputKey"] == 'ECSClusterDefaultInstanceLifecycle':
spot_deployment = False if ImportValue("{self.env}ECSClusterDefaultInstanceLifecycle".format(**locals())) == 'ondemand' else True
instance_lifecycle = key["OutputValue"]
spot_deployment = instance_lifecycle == 'spot'
placement_constraint = {
"PlacementConstraints": [PlacementConstraint(
Type='memberOf',
Expand Down
2 changes: 1 addition & 1 deletion cloudlift/version/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '2.0.6'
VERSION = '2.0.6'

0 comments on commit ab067cd

Please sign in to comment.