mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-31 14:33:08 +02:00
Allow launch template spot instances without mixed policy (#463)
* Add option to enable spot without MixedInstancePolicy * Update docs
This commit is contained in:
committed by
Max Williams
parent
c9986f5e01
commit
fb71eaf6ff
@@ -11,6 +11,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Added
|
### 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 log group tag in `./cluster.tf` (@lucas-giaco)
|
||||||
- Added support for workers iam role tag in `./workers.tf` (@lucas-giaco)
|
- Added support for workers iam role tag in `./workers.tf` (@lucas-giaco)
|
||||||
- Write your awesome addition here (by @you)
|
- Write your awesome addition here (by @you)
|
||||||
|
|||||||
@@ -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"
|
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
|
## Important issues
|
||||||
|
|||||||
1
local.tf
1
local.tf
@@ -56,6 +56,7 @@ locals {
|
|||||||
root_encrypted = "" # Whether the volume should be encrypted or not
|
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)
|
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
|
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
|
# 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
|
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.
|
on_demand_allocation_strategy = "prioritized" # Strategy to use when launching on-demand instances. Valid values: prioritized.
|
||||||
|
|||||||
@@ -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 {
|
block_device_mappings {
|
||||||
device_name = lookup(
|
device_name = lookup(
|
||||||
var.worker_groups_launch_template[count.index],
|
var.worker_groups_launch_template[count.index],
|
||||||
|
|||||||
Reference in New Issue
Block a user