Allow launch template spot instances without mixed policy (#463)

* Add option to enable spot without MixedInstancePolicy

* Update docs
This commit is contained in:
Tarek Abdel Sater
2019-08-06 19:18:06 +03:00
committed by Max Williams
parent c9986f5e01
commit fb71eaf6ff
4 changed files with 22 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Added `market_type` to `workers_launch_template.tf` allow the usage of spot nodegroups without mixed instances policy.
- Added support for log group tag in `./cluster.tf` (@lucas-giaco)
- Added support for workers iam role tag in `./workers.tf` (@lucas-giaco)
- Write your awesome addition here (by @you)

View File

@@ -84,6 +84,18 @@ Launch Template support is a recent addition to both AWS and this module. It mig
kubelet_extra_args = "--node-labels=kubernetes.io/lifecycle=spot"
}
]
worker_groups_launch_template = [
{
name = "spot-2"
instance_type = "m4.xlarge"
asg_max_size = 5
asg_desired_size = 5
autoscaling_enabled = true
kubelet_extra_args = "--node-labels=kubernetes.io/lifecycle=spot"
market_type = "spot"
}
]
```
## Important issues

View File

@@ -56,6 +56,7 @@ locals {
root_encrypted = "" # Whether the volume should be encrypted or not
eni_delete = true # Delete the ENI on termination (if set to false you will have to manually delete before destroying)
cpu_credits = "standard" # T2/T3 unlimited mode, can be 'standard' or 'unlimited'. Used 'standard' mode as default to avoid paying higher costs
market_type = null
# Settings for launch templates with mixed instances policy
override_instance_types = ["m5.large", "m5a.large", "m5d.large", "m5ad.large"] # A list of override instance types for mixed instances policy
on_demand_allocation_strategy = "prioritized" # Strategy to use when launching on-demand instances. Valid values: prioritized.

View File

@@ -229,6 +229,14 @@ resource "aws_launch_template" "workers_launch_template" {
)
}
dynamic instance_market_options {
iterator = item
for_each = lookup(var.worker_groups_launch_template[count.index], "market_type", null) == null ? [] : list(lookup(var.worker_groups_launch_template[count.index], "market_type", null))
content {
market_type = item.value
}
}
block_device_mappings {
device_name = lookup(
var.worker_groups_launch_template[count.index],