diff --git a/generator/resources/eks_addon_test_matrix.json b/generator/resources/eks_addon_test_matrix.json index 8a02e520b..760de280c 100644 --- a/generator/resources/eks_addon_test_matrix.json +++ b/generator/resources/eks_addon_test_matrix.json @@ -1,7 +1,7 @@ [ { "k8sVersion": "1.31", - "ami": "AL2_x86_64_GPU", + "ami": "AL2023_x86_64_NVIDIA", "terraform_dir": "terraform/eks/addon/gpu", "test_dir": "./test/gpu", "instanceType":"g4dn.xlarge" diff --git a/generator/resources/eks_daemon_test_matrix.json b/generator/resources/eks_daemon_test_matrix.json index e11e85915..85287f668 100644 --- a/generator/resources/eks_daemon_test_matrix.json +++ b/generator/resources/eks_daemon_test_matrix.json @@ -1,13 +1,13 @@ [ { "k8sVersion": "1.35", - "ami": "AL2_x86_64", + "ami": "AL2023_x86_64_STANDARD", "instanceType":"t3.medium", "arc": "amd64" }, { "k8sVersion": "1.35", - "ami": "AL2_ARM_64", + "ami": "AL2023_ARM_64_STANDARD", "instanceType":"m6g.large", "arc": "arm64" } diff --git a/generator/test_case_generator.go b/generator/test_case_generator.go index 3c8f5b22d..80fffd00b 100644 --- a/generator/test_case_generator.go +++ b/generator/test_case_generator.go @@ -356,7 +356,7 @@ var testTypeToTestConfig = map[string][]testConfig{ testDir: "./test/metric_value_benchmark", targets: map[string]map[string]struct{}{"arc": {"amd64": {}}}, instanceType: "g4dn.xlarge", - ami: "AL2_x86_64_GPU", + ami: "AL2023_x86_64_NVIDIA", }, { testDir: "./test/metric_value_benchmark", @@ -386,13 +386,13 @@ var testTypeToTestConfig = map[string][]testConfig{ testDir: "./test/gpu", terraformDir: "terraform/eks/daemon/gpu", targets: map[string]map[string]struct{}{"arc": {"amd64": {}}}, instanceType: "g4dn.xlarge", - ami: "AL2_x86_64_GPU", + ami: "AL2023_x86_64_NVIDIA", }, { testDir: "./test/gpu_high_frequency_metrics", terraformDir: "terraform/eks/daemon/gpu", targets: map[string]map[string]struct{}{"arc": {"amd64": {}}}, instanceType: "g4dn.xlarge", - ami: "AL2_x86_64_GPU", + ami: "AL2023_x86_64_NVIDIA", }, { testDir: "./test/awsneuron", terraformDir: "terraform/eks/daemon/awsneuron", diff --git a/terraform/eks/addon/gpu/main.tf b/terraform/eks/addon/gpu/main.tf index 06387f4e1..fbed5faee 100644 --- a/terraform/eks/addon/gpu/main.tf +++ b/terraform/eks/addon/gpu/main.tf @@ -38,6 +38,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-addon-eks-integ-node" @@ -52,9 +61,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/addon/gpu/variables.tf b/terraform/eks/addon/gpu/variables.tf index bb787b6e0..9ab0fd1dc 100644 --- a/terraform/eks/addon/gpu/variables.tf +++ b/terraform/eks/addon/gpu/variables.tf @@ -23,7 +23,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64_GPU" + default = "AL2023_x86_64_NVIDIA" } variable "instance_type" { diff --git a/terraform/eks/daemon/app_signals/main.tf b/terraform/eks/daemon/app_signals/main.tf index cb89952dd..60e3f447b 100644 --- a/terraform/eks/daemon/app_signals/main.tf +++ b/terraform/eks/daemon/app_signals/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" { min_size = 1 } - ami_type = "AL2_x86_64" + ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -373,6 +386,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/app_signals/variables.tf b/terraform/eks/daemon/app_signals/variables.tf index 7f09980c9..a13824972 100644 --- a/terraform/eks/daemon/app_signals/variables.tf +++ b/terraform/eks/daemon/app_signals/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/awsneuron/main.tf b/terraform/eks/daemon/awsneuron/main.tf index e815aa46f..f8b56b2be 100644 --- a/terraform/eks/daemon/awsneuron/main.tf +++ b/terraform/eks/daemon/awsneuron/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" { min_size = 1 } - ami_type = "AL2_x86_64" + ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -672,6 +685,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/awsneuron/variables.tf b/terraform/eks/daemon/awsneuron/variables.tf index a1c82cd81..02c10aeaf 100644 --- a/terraform/eks/daemon/awsneuron/variables.tf +++ b/terraform/eks/daemon/awsneuron/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/credentials/pod_identity/main.tf b/terraform/eks/daemon/credentials/pod_identity/main.tf index cefc79751..404fdd3ef 100644 --- a/terraform/eks/daemon/credentials/pod_identity/main.tf +++ b/terraform/eks/daemon/credentials/pod_identity/main.tf @@ -30,6 +30,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node-${module.common.testing_id}" @@ -44,9 +53,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/daemon/credentials/pod_identity/variables.tf b/terraform/eks/daemon/credentials/pod_identity/variables.tf index 1e963c408..052ec8bf8 100644 --- a/terraform/eks/daemon/credentials/pod_identity/variables.tf +++ b/terraform/eks/daemon/credentials/pod_identity/variables.tf @@ -18,7 +18,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/ebs/main.tf b/terraform/eks/daemon/ebs/main.tf index 3a6762037..aa58e9068 100644 --- a/terraform/eks/daemon/ebs/main.tf +++ b/terraform/eks/daemon/ebs/main.tf @@ -32,6 +32,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-addon-eks-integ-node-${module.common.testing_id}" @@ -46,9 +55,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/daemon/ebs/variables.tf b/terraform/eks/daemon/ebs/variables.tf index 723d364ab..48c375fab 100644 --- a/terraform/eks/daemon/ebs/variables.tf +++ b/terraform/eks/daemon/ebs/variables.tf @@ -33,7 +33,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/emf/main.tf b/terraform/eks/daemon/emf/main.tf index 2a0600c53..7c9f1d15c 100644 --- a/terraform/eks/daemon/emf/main.tf +++ b/terraform/eks/daemon/emf/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" { min_size = 1 } - ami_type = "AL2_x86_64" + ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -367,6 +380,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/emf/variables.tf b/terraform/eks/daemon/emf/variables.tf index 41afe484a..b3ab300ea 100644 --- a/terraform/eks/daemon/emf/variables.tf +++ b/terraform/eks/daemon/emf/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/entity/main.tf b/terraform/eks/daemon/entity/main.tf index 50a9a9060..307f25863 100644 --- a/terraform/eks/daemon/entity/main.tf +++ b/terraform/eks/daemon/entity/main.tf @@ -30,6 +30,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node-${module.common.testing_id}" @@ -44,9 +53,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/daemon/entity/variables.tf b/terraform/eks/daemon/entity/variables.tf index 3063f072e..482dc639a 100644 --- a/terraform/eks/daemon/entity/variables.tf +++ b/terraform/eks/daemon/entity/variables.tf @@ -18,7 +18,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/fluent/bit/variables.tf b/terraform/eks/daemon/fluent/bit/variables.tf index 0138c5212..0ec1af6b9 100644 --- a/terraform/eks/daemon/fluent/bit/variables.tf +++ b/terraform/eks/daemon/fluent/bit/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/fluent/common/main.tf b/terraform/eks/daemon/fluent/common/main.tf index 6bb914bef..71e6d3f60 100644 --- a/terraform/eks/daemon/fluent/common/main.tf +++ b/terraform/eks/daemon/fluent/common/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "cluster" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "node_group" { cluster_name = aws_eks_cluster.cluster.name node_group_name = "cwagent-eks-integ-node" @@ -49,9 +58,13 @@ resource "aws_eks_node_group" "node_group" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -404,6 +417,7 @@ resource "kubernetes_daemonset" "agent_daemon" { path = "/dev/disk/" } } + host_network = true termination_grace_period_seconds = 60 service_account_name = "cloudwatch-agent" } diff --git a/terraform/eks/daemon/fluent/common/variables.tf b/terraform/eks/daemon/fluent/common/variables.tf index 0c0531717..e20011ce4 100644 --- a/terraform/eks/daemon/fluent/common/variables.tf +++ b/terraform/eks/daemon/fluent/common/variables.tf @@ -29,7 +29,7 @@ variable "k8s_version" { // ami_type and instance_type can be used to test ARM node group variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/fluent/d/main.tf b/terraform/eks/daemon/fluent/d/main.tf index 798c90241..92be9be60 100644 --- a/terraform/eks/daemon/fluent/d/main.tf +++ b/terraform/eks/daemon/fluent/d/main.tf @@ -415,6 +415,7 @@ resource "kubernetes_daemonset" "fluentd_daemon" { } spec { service_account_name = "fluentd" + host_network = true termination_grace_period_seconds = 30 init_container { name = "copy-fluentd-config" diff --git a/terraform/eks/daemon/fluent/d/variables.tf b/terraform/eks/daemon/fluent/d/variables.tf index 0138c5212..0ec1af6b9 100644 --- a/terraform/eks/daemon/fluent/d/variables.tf +++ b/terraform/eks/daemon/fluent/d/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/fluent/windows/2019/variables.tf b/terraform/eks/daemon/fluent/windows/2019/variables.tf index 3dd862a7a..a7006b322 100644 --- a/terraform/eks/daemon/fluent/windows/2019/variables.tf +++ b/terraform/eks/daemon/fluent/windows/2019/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/fluent/windows/2022/variables.tf b/terraform/eks/daemon/fluent/windows/2022/variables.tf index a538fe4fc..5efd962b3 100644 --- a/terraform/eks/daemon/fluent/windows/2022/variables.tf +++ b/terraform/eks/daemon/fluent/windows/2022/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/fluent/windows/main.tf b/terraform/eks/daemon/fluent/windows/main.tf index a3d232265..f64a43bb9 100644 --- a/terraform/eks/daemon/fluent/windows/main.tf +++ b/terraform/eks/daemon/fluent/windows/main.tf @@ -113,6 +113,15 @@ EOT } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "node_group" { cluster_name = aws_eks_cluster.cluster.name node_group_name = "cwagent-eks-integ-node" @@ -127,9 +136,13 @@ resource "aws_eks_node_group" "node_group" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -153,9 +166,13 @@ resource "aws_eks_node_group" "node_group_windows" { ami_type = var.windows_ami_type capacity_type = "ON_DEMAND" - disk_size = 50 instance_types = ["t3.large"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_CloudWatchAgentServerPolicy, aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, @@ -492,6 +509,7 @@ resource "kubernetes_daemonset" "agent_daemon" { path = "/dev/disk/" } } + host_network = true termination_grace_period_seconds = 60 service_account_name = "cloudwatch-agent" } diff --git a/terraform/eks/daemon/fluent/windows/variables.tf b/terraform/eks/daemon/fluent/windows/variables.tf index 75273addd..efeca02d8 100644 --- a/terraform/eks/daemon/fluent/windows/variables.tf +++ b/terraform/eks/daemon/fluent/windows/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/gpu/main.tf b/terraform/eks/daemon/gpu/main.tf index 03747ff96..ef4676ec1 100644 --- a/terraform/eks/daemon/gpu/main.tf +++ b/terraform/eks/daemon/gpu/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -49,9 +58,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -371,6 +384,7 @@ resource "kubernetes_daemonset" "exporter" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } @@ -571,6 +585,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/gpu/variables.tf b/terraform/eks/daemon/gpu/variables.tf index 7367ef425..96f9cda78 100644 --- a/terraform/eks/daemon/gpu/variables.tf +++ b/terraform/eks/daemon/gpu/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64_GPU" + default = "AL2023_x86_64_NVIDIA" } variable "instance_type" { diff --git a/terraform/eks/daemon/liscsi/main.tf b/terraform/eks/daemon/liscsi/main.tf index ee1cf6d6c..8459d69d6 100644 --- a/terraform/eks/daemon/liscsi/main.tf +++ b/terraform/eks/daemon/liscsi/main.tf @@ -31,6 +31,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Group + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-liscsi-eks-integ-node-${module.common.testing_id}" @@ -45,9 +54,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/daemon/liscsi/variables.tf b/terraform/eks/daemon/liscsi/variables.tf index e46ecf550..4b79ef02f 100644 --- a/terraform/eks/daemon/liscsi/variables.tf +++ b/terraform/eks/daemon/liscsi/variables.tf @@ -33,7 +33,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/main.tf b/terraform/eks/daemon/main.tf index 029985922..5c028d547 100644 --- a/terraform/eks/daemon/main.tf +++ b/terraform/eks/daemon/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" { min_size = 1 } - ami_type = "AL2_x86_64" + ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -312,6 +325,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/otel-attr-limit/main.tf b/terraform/eks/daemon/otel-attr-limit/main.tf index 61c105818..3ffd1cb14 100644 --- a/terraform/eks/daemon/otel-attr-limit/main.tf +++ b/terraform/eks/daemon/otel-attr-limit/main.tf @@ -58,6 +58,15 @@ resource "aws_eks_cluster" "this" { # --- 3 Node Groups: low, mid, high --- + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "low" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-attr-limit-low-${module.common.testing_id}" @@ -72,8 +81,12 @@ resource "aws_eks_node_group" "low" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } labels = local.low_labels depends_on = [ @@ -97,8 +110,12 @@ resource "aws_eks_node_group" "mid" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } labels = local.mid_labels depends_on = [ @@ -122,8 +139,12 @@ resource "aws_eks_node_group" "high" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } labels = local.high_labels depends_on = [ diff --git a/terraform/eks/daemon/otel-ebs-csi/main.tf b/terraform/eks/daemon/otel-ebs-csi/main.tf index 1703aa830..2ed0ac701 100644 --- a/terraform/eks/daemon/otel-ebs-csi/main.tf +++ b/terraform/eks/daemon/otel-ebs-csi/main.tf @@ -27,6 +27,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Group — 1x t3.medium with node-color=blue label + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-otel-integ-node-${module.common.testing_id}" @@ -41,9 +50,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "ci-test.example.com/node-color" = "blue" } diff --git a/terraform/eks/daemon/otel-efa/main.tf b/terraform/eks/daemon/otel-efa/main.tf index e39704cd9..29f372fa0 100644 --- a/terraform/eks/daemon/otel-efa/main.tf +++ b/terraform/eks/daemon/otel-efa/main.tf @@ -74,7 +74,6 @@ resource "aws_eks_node_group" "standard" { ami_type = "AL2023_x86_64_STANDARD" capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] depends_on = [ diff --git a/terraform/eks/daemon/otel-gpu/main.tf b/terraform/eks/daemon/otel-gpu/main.tf index c16755aac..63e8456ff 100644 --- a/terraform/eks/daemon/otel-gpu/main.tf +++ b/terraform/eks/daemon/otel-gpu/main.tf @@ -56,6 +56,15 @@ resource "aws_iam_role_policy_attachment" "node_AmazonEC2ContainerRegistryReadOn # --- Standard Node Group (for operator, CoreDNS, KSM) --- + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "standard" { cluster_name = aws_eks_cluster.this.name node_group_name = "standard-${module.common.testing_id}" @@ -70,9 +79,13 @@ resource "aws_eks_node_group" "standard" { ami_type = "AL2023_x86_64_STANDARD" capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -97,9 +110,13 @@ resource "aws_eks_node_group" "gpu_single" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "nvidia.com/gpu.present" = "true" "ci-test.example.com/node-color" = "green" @@ -133,9 +150,13 @@ resource "aws_eks_node_group" "gpu_multi" { ami_type = "AL2023_x86_64_NVIDIA" capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["g4dn.12xlarge"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "nvidia.com/gpu.present" = "true" "ci-test.example.com/node-color" = "green" diff --git a/terraform/eks/daemon/otel-lis-csi/main.tf b/terraform/eks/daemon/otel-lis-csi/main.tf index 755096683..f0c242f1c 100644 --- a/terraform/eks/daemon/otel-lis-csi/main.tf +++ b/terraform/eks/daemon/otel-lis-csi/main.tf @@ -27,6 +27,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Group + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-otel-liscsi-integ-node-${module.common.testing_id}" @@ -41,9 +50,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/daemon/otel-neuron/main.tf b/terraform/eks/daemon/otel-neuron/main.tf index 34ac3b633..8029bd6da 100644 --- a/terraform/eks/daemon/otel-neuron/main.tf +++ b/terraform/eks/daemon/otel-neuron/main.tf @@ -29,6 +29,15 @@ resource "aws_eks_cluster" "this" { # --- Node Groups --- # Standard node group (operator/CoreDNS) + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "standard" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-otel-standard-${module.common.testing_id}" @@ -43,9 +52,13 @@ resource "aws_eks_node_group" "standard" { ami_type = "AL2023_x86_64_STANDARD" capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -68,9 +81,13 @@ resource "aws_eks_node_group" "neuron_workload" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 50 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "aws.amazon.com/neuron.present" = "true" "ci-test.example.com/node-color" = "red" @@ -104,9 +121,13 @@ resource "aws_eks_node_group" "neuron_idle" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 50 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "aws.amazon.com/neuron.present" = "true" "ci-test.example.com/node-color" = "red" @@ -152,9 +173,13 @@ resource "aws_eks_node_group" "neuron_multi_device" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 100 instance_types = [var.multi_device_instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "aws.amazon.com/neuron.present" = "true" "ci-test.example.com/node-color" = "purple" diff --git a/terraform/eks/daemon/otel/main.tf b/terraform/eks/daemon/otel/main.tf index 61dae97fb..6663ae176 100644 --- a/terraform/eks/daemon/otel/main.tf +++ b/terraform/eks/daemon/otel/main.tf @@ -27,6 +27,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Group — 2x t3.medium with node-color=blue label + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-otel-integ-node-${module.common.testing_id}" @@ -41,9 +50,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + labels = { "ci-test.example.com/node-color" = "blue" } diff --git a/terraform/eks/daemon/statsd/main.tf b/terraform/eks/daemon/statsd/main.tf index 79f6d3c26..4ebcc1fb4 100644 --- a/terraform/eks/daemon/statsd/main.tf +++ b/terraform/eks/daemon/statsd/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" { min_size = 1 } - ami_type = "AL2_x86_64" + ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -361,6 +374,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/statsd/variables.tf b/terraform/eks/daemon/statsd/variables.tf index 5301e1564..1ff0ccfc1 100644 --- a/terraform/eks/daemon/statsd/variables.tf +++ b/terraform/eks/daemon/statsd/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/variables.tf b/terraform/eks/daemon/variables.tf index 0138c5212..0ec1af6b9 100644 --- a/terraform/eks/daemon/variables.tf +++ b/terraform/eks/daemon/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/windows/2019/variables.tf b/terraform/eks/daemon/windows/2019/variables.tf index 7c9823e2b..d7d7547f9 100644 --- a/terraform/eks/daemon/windows/2019/variables.tf +++ b/terraform/eks/daemon/windows/2019/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/windows/2022/variables.tf b/terraform/eks/daemon/windows/2022/variables.tf index 75273addd..efeca02d8 100644 --- a/terraform/eks/daemon/windows/2022/variables.tf +++ b/terraform/eks/daemon/windows/2022/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/daemon/windows/main.tf b/terraform/eks/daemon/windows/main.tf index a4233d60f..0c0861702 100644 --- a/terraform/eks/daemon/windows/main.tf +++ b/terraform/eks/daemon/windows/main.tf @@ -105,6 +105,15 @@ EOT } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -117,11 +126,15 @@ resource "aws_eks_node_group" "this" { min_size = 1 } - ami_type = "AL2_x86_64" + ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, @@ -162,9 +175,13 @@ resource "aws_eks_node_group" "node_group_windows" { ami_type = var.windows_ami_type capacity_type = "ON_DEMAND" - disk_size = 50 instance_types = ["t3.large"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_CloudWatchAgentServerPolicy, aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, @@ -408,6 +425,7 @@ resource "kubernetes_daemonset" "service" { } } service_account_name = "cloudwatch-agent" + host_network = true termination_grace_period_seconds = 60 } } diff --git a/terraform/eks/daemon/windows/variables.tf b/terraform/eks/daemon/windows/variables.tf index 75273addd..efeca02d8 100644 --- a/terraform/eks/daemon/windows/variables.tf +++ b/terraform/eks/daemon/windows/variables.tf @@ -28,7 +28,7 @@ variable "k8s_version" { variable "ami_type" { type = string - default = "AL2_x86_64" + default = "AL2023_x86_64_STANDARD" } variable "instance_type" { diff --git a/terraform/eks/deployment/main.tf b/terraform/eks/deployment/main.tf index d9b3095ec..d88313054 100644 --- a/terraform/eks/deployment/main.tf +++ b/terraform/eks/deployment/main.tf @@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" { } # EKS Node Groups + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "cwagent-eks-integ-node" @@ -49,9 +58,13 @@ resource "aws_eks_node_group" "this" { ami_type = var.k8s_version >= "1.33" ? "AL2023_x86_64_STANDARD" : "AL2_x86_64" capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = ["t3.medium"] + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } + depends_on = [ aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly, aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy, diff --git a/terraform/eks/e2e/main.tf b/terraform/eks/e2e/main.tf index 1d23bf97a..e62569f81 100644 --- a/terraform/eks/e2e/main.tf +++ b/terraform/eks/e2e/main.tf @@ -30,6 +30,15 @@ resource "aws_eks_cluster" "this" { } } + +resource "aws_launch_template" "node" { + metadata_options { + http_endpoint = "enabled" + http_tokens = "required" + http_put_response_hop_limit = 2 + } +} + resource "aws_eks_node_group" "this" { cluster_name = aws_eks_cluster.this.name node_group_name = "${local.cluster_name}-node" @@ -42,8 +51,12 @@ resource "aws_eks_node_group" "this" { } ami_type = var.ami_type capacity_type = "ON_DEMAND" - disk_size = 20 instance_types = [var.instance_type] + + launch_template { + id = aws_launch_template.node.id + version = aws_launch_template.node.latest_version + } depends_on = [ aws_iam_role_policy_attachment.node_CloudWatchAgentServerPolicy, aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly,