mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-17 00:57:28 +01:00
feat: Add the SPOT support for Managed Node Groups (#1129)
BREAKING CHANGES: To add add SPOT support for MNG, the `instance_type` is now a list and renamed as `instance_types`. This will probably rebuild existing Managed Node Groups.
This commit is contained in:
@@ -100,7 +100,8 @@ module "eks" {
|
||||
max_capacity = 10
|
||||
min_capacity = 1
|
||||
|
||||
instance_type = "m5.large"
|
||||
instance_types = ["m5.large"]
|
||||
capacity_type = "SPOT"
|
||||
k8s_labels = {
|
||||
Environment = "test"
|
||||
GithubRepo = "terraform-aws-eks"
|
||||
|
||||
@@ -20,10 +20,11 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
|
||||
| additional\_tags | Additional tags to apply to node group | map(string) | Only `var.tags` applied |
|
||||
| ami\_release\_version | AMI version of workers | string | Provider default behavior |
|
||||
| ami\_type | AMI Type. See Terraform or AWS docs | string | Provider default behavior |
|
||||
| capacity\_type | Type of instance capacity to provision. Options are `ON_DEMAND` and `SPOT` | string | Provider default behavior |
|
||||
| desired\_capacity | Desired number of workers | number | `var.workers_group_defaults[asg_desired_capacity]` |
|
||||
| disk\_size | Workers' disk size | number | Provider default behavior |
|
||||
| iam\_role\_arn | IAM role ARN for workers | string | `var.default_iam_role_arn` |
|
||||
| instance\_type | Workers' instance type | string | `var.workers_group_defaults[instance_type]` |
|
||||
| instance\_types | Node group's instance type(s). Multiple types can be specified when `capacity_type="SPOT"`. | list | `[var.workers_group_defaults[instance_type]]` |
|
||||
| k8s\_labels | Kubernetes labels | map(string) | No labels applied |
|
||||
| key\_name | Key name for workers. Set to empty string to disable remote access | string | `var.workers_group_defaults[key_name]` |
|
||||
| launch_template_id | The id of a aws_launch_template to use | string | No LT used |
|
||||
|
||||
@@ -4,7 +4,7 @@ locals {
|
||||
{
|
||||
desired_capacity = var.workers_group_defaults["asg_desired_capacity"]
|
||||
iam_role_arn = var.default_iam_role_arn
|
||||
instance_type = var.workers_group_defaults["instance_type"]
|
||||
instance_types = [var.workers_group_defaults["instance_type"]]
|
||||
key_name = var.workers_group_defaults["key_name"]
|
||||
launch_template_id = var.workers_group_defaults["launch_template_id"]
|
||||
launch_template_version = var.workers_group_defaults["launch_template_version"]
|
||||
|
||||
@@ -15,8 +15,9 @@ resource "aws_eks_node_group" "workers" {
|
||||
|
||||
ami_type = lookup(each.value, "ami_type", null)
|
||||
disk_size = lookup(each.value, "disk_size", null)
|
||||
instance_types = each.value["launch_template_id"] != null ? [] : [each.value["instance_type"]]
|
||||
instance_types = lookup(each.value, "instance_types", null)
|
||||
release_version = lookup(each.value, "ami_release_version", null)
|
||||
capacity_type = lookup(each.value, "capacity_type", null)
|
||||
|
||||
dynamic "remote_access" {
|
||||
for_each = each.value["key_name"] != "" ? [{
|
||||
|
||||
@@ -7,8 +7,11 @@ resource "random_pet" "node_groups" {
|
||||
keepers = {
|
||||
ami_type = lookup(each.value, "ami_type", null)
|
||||
disk_size = lookup(each.value, "disk_size", null)
|
||||
instance_type = each.value["instance_type"]
|
||||
capacity_type = lookup(each.value, "capacity_type", null)
|
||||
iam_role_arn = each.value["iam_role_arn"]
|
||||
instance_types = join("|", compact(
|
||||
lookup(each.value, "instance_types", [])
|
||||
))
|
||||
|
||||
key_name = each.value["key_name"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user