Skip to content

Commit 6d261ea

Browse files
committed
fix(eks): migrate all AMI types from AL2 to AL2023 for K8s 1.33+
AL2_x86_64 and AL2_ARM_64 are no longer supported on K8s 1.33+. - Update test matrix JSON to AL2023_x86_64_STANDARD / AL2023_ARM_64_STANDARD - Update GPU AMI to AL2023_x86_64_NVIDIA in generator and addon matrix - Update all variables.tf defaults to AL2023 - Replace hardcoded ami_type in main.tf with var.ami_type
1 parent 9a2c3c7 commit 6d261ea

47 files changed

Lines changed: 396 additions & 64 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generator/resources/eks_addon_test_matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"k8sVersion": "1.31",
4-
"ami": "AL2_x86_64_GPU",
4+
"ami": "AL2023_x86_64_NVIDIA",
55
"terraform_dir": "terraform/eks/addon/gpu",
66
"test_dir": "./test/gpu",
77
"instanceType":"g4dn.xlarge"

generator/resources/eks_daemon_test_matrix.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[
22
{
33
"k8sVersion": "1.35",
4-
"ami": "AL2_x86_64",
4+
"ami": "AL2023_x86_64_STANDARD",
55
"instanceType":"t3.medium",
66
"arc": "amd64"
77
},
88
{
99
"k8sVersion": "1.35",
10-
"ami": "AL2_ARM_64",
10+
"ami": "AL2023_ARM_64_STANDARD",
1111
"instanceType":"m6g.large",
1212
"arc": "arm64"
1313
}

generator/test_case_generator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ var testTypeToTestConfig = map[string][]testConfig{
356356
testDir: "./test/metric_value_benchmark",
357357
targets: map[string]map[string]struct{}{"arc": {"amd64": {}}},
358358
instanceType: "g4dn.xlarge",
359-
ami: "AL2_x86_64_GPU",
359+
ami: "AL2023_x86_64_NVIDIA",
360360
},
361361
{
362362
testDir: "./test/metric_value_benchmark",
@@ -386,13 +386,13 @@ var testTypeToTestConfig = map[string][]testConfig{
386386
testDir: "./test/gpu", terraformDir: "terraform/eks/daemon/gpu",
387387
targets: map[string]map[string]struct{}{"arc": {"amd64": {}}},
388388
instanceType: "g4dn.xlarge",
389-
ami: "AL2_x86_64_GPU",
389+
ami: "AL2023_x86_64_NVIDIA",
390390
},
391391
{
392392
testDir: "./test/gpu_high_frequency_metrics", terraformDir: "terraform/eks/daemon/gpu",
393393
targets: map[string]map[string]struct{}{"arc": {"amd64": {}}},
394394
instanceType: "g4dn.xlarge",
395-
ami: "AL2_x86_64_GPU",
395+
ami: "AL2023_x86_64_NVIDIA",
396396
},
397397
{
398398
testDir: "./test/awsneuron", terraformDir: "terraform/eks/daemon/awsneuron",

terraform/eks/addon/gpu/main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ resource "aws_eks_cluster" "this" {
3838
}
3939

4040
# EKS Node Groups
41+
42+
resource "aws_launch_template" "node" {
43+
metadata_options {
44+
http_endpoint = "enabled"
45+
http_tokens = "required"
46+
http_put_response_hop_limit = 2
47+
}
48+
}
49+
4150
resource "aws_eks_node_group" "this" {
4251
cluster_name = aws_eks_cluster.this.name
4352
node_group_name = "cwagent-addon-eks-integ-node"
@@ -52,9 +61,13 @@ resource "aws_eks_node_group" "this" {
5261

5362
ami_type = var.ami_type
5463
capacity_type = "ON_DEMAND"
55-
disk_size = 20
5664
instance_types = [var.instance_type]
5765

66+
launch_template {
67+
id = aws_launch_template.node.id
68+
version = aws_launch_template.node.latest_version
69+
}
70+
5871
depends_on = [
5972
aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly,
6073
aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy,

terraform/eks/addon/gpu/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ variable "k8s_version" {
2323

2424
variable "ami_type" {
2525
type = string
26-
default = "AL2_x86_64_GPU"
26+
default = "AL2023_x86_64_NVIDIA"
2727
}
2828

2929
variable "instance_type" {

terraform/eks/daemon/app_signals/main.tf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" {
3535
}
3636

3737
# EKS Node Groups
38+
39+
resource "aws_launch_template" "node" {
40+
metadata_options {
41+
http_endpoint = "enabled"
42+
http_tokens = "required"
43+
http_put_response_hop_limit = 2
44+
}
45+
}
46+
3847
resource "aws_eks_node_group" "this" {
3948
cluster_name = aws_eks_cluster.this.name
4049
node_group_name = "cwagent-eks-integ-node"
@@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" {
4756
min_size = 1
4857
}
4958

50-
ami_type = "AL2_x86_64"
59+
ami_type = var.ami_type
5160
capacity_type = "ON_DEMAND"
52-
disk_size = 20
5361
instance_types = ["t3.medium"]
5462

63+
launch_template {
64+
id = aws_launch_template.node.id
65+
version = aws_launch_template.node.latest_version
66+
}
67+
5568
depends_on = [
5669
aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly,
5770
aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy,
@@ -373,6 +386,7 @@ resource "kubernetes_daemonset" "service" {
373386
}
374387
}
375388
service_account_name = "cloudwatch-agent"
389+
host_network = true
376390
termination_grace_period_seconds = 60
377391
}
378392
}

terraform/eks/daemon/app_signals/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variable "k8s_version" {
2828

2929
variable "ami_type" {
3030
type = string
31-
default = "AL2_x86_64"
31+
default = "AL2023_x86_64_STANDARD"
3232
}
3333

3434
variable "instance_type" {

terraform/eks/daemon/awsneuron/main.tf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ resource "aws_eks_cluster" "this" {
3535
}
3636

3737
# EKS Node Groups
38+
39+
resource "aws_launch_template" "node" {
40+
metadata_options {
41+
http_endpoint = "enabled"
42+
http_tokens = "required"
43+
http_put_response_hop_limit = 2
44+
}
45+
}
46+
3847
resource "aws_eks_node_group" "this" {
3948
cluster_name = aws_eks_cluster.this.name
4049
node_group_name = "cwagent-eks-integ-node"
@@ -47,11 +56,15 @@ resource "aws_eks_node_group" "this" {
4756
min_size = 1
4857
}
4958

50-
ami_type = "AL2_x86_64"
59+
ami_type = var.ami_type
5160
capacity_type = "ON_DEMAND"
52-
disk_size = 20
5361
instance_types = ["t3.medium"]
5462

63+
launch_template {
64+
id = aws_launch_template.node.id
65+
version = aws_launch_template.node.latest_version
66+
}
67+
5568
depends_on = [
5669
aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly,
5770
aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy,
@@ -672,6 +685,7 @@ resource "kubernetes_daemonset" "service" {
672685
}
673686
}
674687
service_account_name = "cloudwatch-agent"
688+
host_network = true
675689
termination_grace_period_seconds = 60
676690
}
677691
}

terraform/eks/daemon/awsneuron/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variable "k8s_version" {
2828

2929
variable "ami_type" {
3030
type = string
31-
default = "AL2_x86_64"
31+
default = "AL2023_x86_64_STANDARD"
3232
}
3333

3434
variable "instance_type" {

terraform/eks/daemon/credentials/pod_identity/main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ resource "aws_eks_cluster" "this" {
3030
}
3131

3232
# EKS Node Groups
33+
34+
resource "aws_launch_template" "node" {
35+
metadata_options {
36+
http_endpoint = "enabled"
37+
http_tokens = "required"
38+
http_put_response_hop_limit = 2
39+
}
40+
}
41+
3342
resource "aws_eks_node_group" "this" {
3443
cluster_name = aws_eks_cluster.this.name
3544
node_group_name = "cwagent-eks-integ-node-${module.common.testing_id}"
@@ -44,9 +53,13 @@ resource "aws_eks_node_group" "this" {
4453

4554
ami_type = var.ami_type
4655
capacity_type = "ON_DEMAND"
47-
disk_size = 20
4856
instance_types = [var.instance_type]
4957

58+
launch_template {
59+
id = aws_launch_template.node.id
60+
version = aws_launch_template.node.latest_version
61+
}
62+
5063
depends_on = [
5164
aws_iam_role_policy_attachment.node_AmazonEC2ContainerRegistryReadOnly,
5265
aws_iam_role_policy_attachment.node_AmazonEKS_CNI_Policy,

0 commit comments

Comments
 (0)