From e70bbba00dc80cab4d77858e2c081c3b47ef27a6 Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Wed, 8 Dec 2021 09:51:39 -0500 Subject: [PATCH] chore: update examples after final validation --- examples/complete/main.tf | 32 ++++---------- examples/irsa_autoscale_refresh/main.tf | 53 +++++++++++++++++++++++- examples/self_managed_node_group/main.tf | 1 - node_groups.tf | 2 +- 4 files changed, 61 insertions(+), 27 deletions(-) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index a46c57c5b89..cb68d225319 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -53,31 +53,15 @@ module "eks" { } self_managed_node_groups = { - one = { - name = "spot-1" - - public_ip = true - max_size = 5 - desired_size = 2 - - use_mixed_instances_policy = true - mixed_instances_policy = { - instances_distribution = { - on_demand_base_capacity = 0 - on_demand_percentage_above_base_capacity = 10 - spot_allocation_strategy = "capacity-optimized" + spot = { + create_launch_template = true + launch_template_name = "spot" + + instance_market_options = { + market_type = "spot" + spot_options = { + block_duration_minutes = 60 } - - override = [ - { - instance_type = "m5.large" - weighted_capacity = "1" - }, - { - instance_type = "m6i.large" - weighted_capacity = "2" - }, - ] } pre_bootstrap_user_data = <<-EOT diff --git a/examples/irsa_autoscale_refresh/main.tf b/examples/irsa_autoscale_refresh/main.tf index 4f9c747dc10..f344fc1295b 100644 --- a/examples/irsa_autoscale_refresh/main.tf +++ b/examples/irsa_autoscale_refresh/main.tf @@ -60,7 +60,58 @@ module "eks" { propogate_tags = [{ key = "aws-node-termination-handler/managed" - value = "" + value = true + propagate_at_launch = true + }] + } + + mixed_instance = { + create_launch_template = true + launch_template_name = "mixed-instance" + + use_mixed_instances_policy = true + mixed_instances_policy = { + instances_distribution = { + on_demand_base_capacity = 0 + on_demand_percentage_above_base_capacity = 10 + spot_allocation_strategy = "capacity-optimized" + } + + override = [ + { + instance_type = "m5.large" + weighted_capacity = "1" + }, + { + instance_type = "m6i.large" + weighted_capacity = "2" + }, + ] + } + + propogate_tags = [{ + key = "aws-node-termination-handler/managed" + value = true + propagate_at_launch = true + }] + } + + spot = { + create_launch_template = true + launch_template_name = "spot" + + instance_market_options = { + market_type = "spot" + spot_options = { + block_duration_minutes = 60 + } + } + + bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'" + + propogate_tags = [{ + key = "aws-node-termination-handler/managed" + value = true propagate_at_launch = true }] } diff --git a/examples/self_managed_node_group/main.tf b/examples/self_managed_node_group/main.tf index 7646d24411f..51e23de7255 100644 --- a/examples/self_managed_node_group/main.tf +++ b/examples/self_managed_node_group/main.tf @@ -125,7 +125,6 @@ module "eks" { launch_template_name = "self-managed-ex" launch_template_use_name_prefix = true description = "Self managed node group example launch template" - launch_template_default_version = true ebs_optimized = true vpc_security_group_ids = [aws_security_group.additional.id] diff --git a/node_groups.tf b/node_groups.tf index 12a716c3c1d..bcfbb12aa1c 100644 --- a/node_groups.tf +++ b/node_groups.tf @@ -286,7 +286,7 @@ module "self_managed_node_group" { # Autoscaling Group name = try(each.value.name, each.key) - use_name_prefix = try(each.value.use_name_prefix, var.self_managed_node_group_defaults.use_name_prefix, false) + use_name_prefix = try(each.value.use_name_prefix, var.self_managed_node_group_defaults.use_name_prefix, true) launch_template_name = try(each.value.launch_template_name, each.key) launch_template_version = try(each.value.launch_template_version, var.self_managed_node_group_defaults.launch_template_version, null)