mirror of
https://github.com/terraform-aws-modules/terraform-aws-eks.git
synced 2025-09-09 19:32:58 +08:00
fix: Allow instance_requirements to be set in self-managed node groups (#3455)
This commit is contained in:
@@ -321,7 +321,7 @@ resource "aws_launch_template" "this" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instance_type = var.instance_type
|
instance_type = var.instance_requirements != null ? null : var.instance_type
|
||||||
kernel_id = var.kernel_id
|
kernel_id = var.kernel_id
|
||||||
key_name = var.key_name
|
key_name = var.key_name
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,79 @@ module "eks" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Complete
|
instance_attributes = {
|
||||||
|
name = "instance-attributes"
|
||||||
|
|
||||||
|
min_size = 1
|
||||||
|
max_size = 2
|
||||||
|
desired_size = 1
|
||||||
|
|
||||||
|
cloudinit_pre_nodeadm = [{
|
||||||
|
content = <<-EOT
|
||||||
|
---
|
||||||
|
apiVersion: node.eks.aws/v1alpha1
|
||||||
|
kind: NodeConfig
|
||||||
|
spec:
|
||||||
|
kubelet:
|
||||||
|
config:
|
||||||
|
shutdownGracePeriod: 30s
|
||||||
|
EOT
|
||||||
|
content_type = "application/node.eks.aws"
|
||||||
|
}]
|
||||||
|
|
||||||
|
instance_type = null
|
||||||
|
|
||||||
|
# launch template configuration
|
||||||
|
instance_requirements = {
|
||||||
|
cpu_manufacturers = ["intel"]
|
||||||
|
instance_generations = ["current", "previous"]
|
||||||
|
spot_max_price_percentage_over_lowest_price = 100
|
||||||
|
|
||||||
|
memory_mib = {
|
||||||
|
min = 8192
|
||||||
|
}
|
||||||
|
|
||||||
|
vcpu_count = {
|
||||||
|
min = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
allowed_instance_types = ["t*", "m*"]
|
||||||
|
}
|
||||||
|
|
||||||
|
use_mixed_instances_policy = true
|
||||||
|
mixed_instances_policy = {
|
||||||
|
instances_distribution = {
|
||||||
|
on_demand_base_capacity = 0
|
||||||
|
on_demand_percentage_above_base_capacity = 0
|
||||||
|
on_demand_allocation_strategy = "lowest-price"
|
||||||
|
spot_allocation_strategy = "price-capacity-optimized"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ASG configuration
|
||||||
|
launch_template = {
|
||||||
|
override = [
|
||||||
|
{
|
||||||
|
instance_requirements = {
|
||||||
|
cpu_manufacturers = ["intel"]
|
||||||
|
instance_generations = ["current", "previous"]
|
||||||
|
spot_max_price_percentage_over_lowest_price = 100
|
||||||
|
|
||||||
|
memory_mib = {
|
||||||
|
min = 8192
|
||||||
|
}
|
||||||
|
|
||||||
|
vcpu_count = {
|
||||||
|
min = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
allowed_instance_types = ["t*", "m*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
complete = {
|
complete = {
|
||||||
name = "complete-self-mng"
|
name = "complete-self-mng"
|
||||||
use_name_prefix = false
|
use_name_prefix = false
|
||||||
@@ -212,73 +284,6 @@ module "eks" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instance_attributes = {
|
|
||||||
name = "instance-attributes"
|
|
||||||
|
|
||||||
min_size = 1
|
|
||||||
max_size = 2
|
|
||||||
desired_size = 1
|
|
||||||
|
|
||||||
bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'"
|
|
||||||
|
|
||||||
cloudinit_pre_nodeadm = [{
|
|
||||||
content = <<-EOT
|
|
||||||
---
|
|
||||||
apiVersion: node.eks.aws/v1alpha1
|
|
||||||
kind: NodeConfig
|
|
||||||
spec:
|
|
||||||
kubelet:
|
|
||||||
config:
|
|
||||||
shutdownGracePeriod: 30s
|
|
||||||
EOT
|
|
||||||
content_type = "application/node.eks.aws"
|
|
||||||
}]
|
|
||||||
|
|
||||||
instance_type = null
|
|
||||||
|
|
||||||
# launch template configuration
|
|
||||||
instance_requirements = {
|
|
||||||
cpu_manufacturers = ["intel"]
|
|
||||||
instance_generations = ["current", "previous"]
|
|
||||||
spot_max_price_percentage_over_lowest_price = 100
|
|
||||||
|
|
||||||
vcpu_count = {
|
|
||||||
min = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
allowed_instance_types = ["t*", "m*"]
|
|
||||||
}
|
|
||||||
|
|
||||||
use_mixed_instances_policy = true
|
|
||||||
mixed_instances_policy = {
|
|
||||||
instances_distribution = {
|
|
||||||
on_demand_base_capacity = 0
|
|
||||||
on_demand_percentage_above_base_capacity = 0
|
|
||||||
on_demand_allocation_strategy = "lowest-price"
|
|
||||||
spot_allocation_strategy = "price-capacity-optimized"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ASG configuration
|
|
||||||
launch_template = {
|
|
||||||
override = [
|
|
||||||
{
|
|
||||||
instance_requirements = {
|
|
||||||
cpu_manufacturers = ["intel"]
|
|
||||||
instance_generations = ["current", "previous"]
|
|
||||||
spot_max_price_percentage_over_lowest_price = 100
|
|
||||||
|
|
||||||
vcpu_count = {
|
|
||||||
min = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
allowed_instance_types = ["t*", "m*"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
metadata_options = {
|
metadata_options = {
|
||||||
http_endpoint = "enabled"
|
http_endpoint = "enabled"
|
||||||
http_tokens = "required"
|
http_tokens = "required"
|
||||||
|
|||||||
Reference in New Issue
Block a user