Skip to content

Commit 9a2acef

Browse files
Make AL2023 be the default for all k8s version to handle AL2 deprecation (#8593)
1 parent f9b242b commit 9a2acef

File tree

8 files changed

+26
-54
lines changed

8 files changed

+26
-54
lines changed

pkg/apis/eksctl.io/v1alpha5/assets/schema.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,12 +1432,12 @@
14321432
},
14331433
"amiFamily": {
14341434
"type": "string",
1435-
"description": "Valid variants are: `\"AmazonLinux2\"` (default), `\"AmazonLinux2023\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"UbuntuPro2004\"`, `\"Ubuntu2004\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
1436-
"x-intellij-html-description": "Valid variants are: <code>&quot;AmazonLinux2&quot;</code> (default), <code>&quot;AmazonLinux2023&quot;</code>, <code>&quot;UbuntuPro2404&quot;</code>, <code>&quot;Ubuntu2404&quot;</code>, <code>&quot;UbuntuPro2204&quot;</code>, <code>&quot;Ubuntu2204&quot;</code>, <code>&quot;UbuntuPro2004&quot;</code>, <code>&quot;Ubuntu2004&quot;</code>, <code>&quot;Bottlerocket&quot;</code>, <code>&quot;WindowsServer2019CoreContainer&quot;</code>, <code>&quot;WindowsServer2019FullContainer&quot;</code>, <code>&quot;WindowsServer2022CoreContainer&quot;</code>, <code>&quot;WindowsServer2022FullContainer&quot;</code>.",
1437-
"default": "AmazonLinux2",
1435+
"description": "Valid variants are: `\"AmazonLinux2023\"` (default), `\"AmazonLinux2\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"UbuntuPro2004\"`, `\"Ubuntu2004\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
1436+
"x-intellij-html-description": "Valid variants are: <code>&quot;AmazonLinux2023&quot;</code> (default), <code>&quot;AmazonLinux2&quot;</code>, <code>&quot;UbuntuPro2404&quot;</code>, <code>&quot;Ubuntu2404&quot;</code>, <code>&quot;UbuntuPro2204&quot;</code>, <code>&quot;Ubuntu2204&quot;</code>, <code>&quot;UbuntuPro2004&quot;</code>, <code>&quot;Ubuntu2004&quot;</code>, <code>&quot;Bottlerocket&quot;</code>, <code>&quot;WindowsServer2019CoreContainer&quot;</code>, <code>&quot;WindowsServer2019FullContainer&quot;</code>, <code>&quot;WindowsServer2022CoreContainer&quot;</code>, <code>&quot;WindowsServer2022FullContainer&quot;</code>.",
1437+
"default": "AmazonLinux2023",
14381438
"enum": [
1439-
"AmazonLinux2",
14401439
"AmazonLinux2023",
1440+
"AmazonLinux2",
14411441
"UbuntuPro2404",
14421442
"Ubuntu2404",
14431443
"UbuntuPro2204",
@@ -1782,12 +1782,12 @@
17821782
},
17831783
"amiFamily": {
17841784
"type": "string",
1785-
"description": "Valid variants are: `\"AmazonLinux2\"` (default), `\"AmazonLinux2023\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"UbuntuPro2004\"`, `\"Ubuntu2004\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
1786-
"x-intellij-html-description": "Valid variants are: <code>&quot;AmazonLinux2&quot;</code> (default), <code>&quot;AmazonLinux2023&quot;</code>, <code>&quot;UbuntuPro2404&quot;</code>, <code>&quot;Ubuntu2404&quot;</code>, <code>&quot;UbuntuPro2204&quot;</code>, <code>&quot;Ubuntu2204&quot;</code>, <code>&quot;UbuntuPro2004&quot;</code>, <code>&quot;Ubuntu2004&quot;</code>, <code>&quot;Bottlerocket&quot;</code>, <code>&quot;WindowsServer2019CoreContainer&quot;</code>, <code>&quot;WindowsServer2019FullContainer&quot;</code>, <code>&quot;WindowsServer2022CoreContainer&quot;</code>, <code>&quot;WindowsServer2022FullContainer&quot;</code>.",
1787-
"default": "AmazonLinux2",
1785+
"description": "Valid variants are: `\"AmazonLinux2023\"` (default), `\"AmazonLinux2\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"UbuntuPro2004\"`, `\"Ubuntu2004\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
1786+
"x-intellij-html-description": "Valid variants are: <code>&quot;AmazonLinux2023&quot;</code> (default), <code>&quot;AmazonLinux2&quot;</code>, <code>&quot;UbuntuPro2404&quot;</code>, <code>&quot;Ubuntu2404&quot;</code>, <code>&quot;UbuntuPro2204&quot;</code>, <code>&quot;Ubuntu2204&quot;</code>, <code>&quot;UbuntuPro2004&quot;</code>, <code>&quot;Ubuntu2004&quot;</code>, <code>&quot;Bottlerocket&quot;</code>, <code>&quot;WindowsServer2019CoreContainer&quot;</code>, <code>&quot;WindowsServer2019FullContainer&quot;</code>, <code>&quot;WindowsServer2022CoreContainer&quot;</code>, <code>&quot;WindowsServer2022FullContainer&quot;</code>.",
1787+
"default": "AmazonLinux2023",
17881788
"enum": [
1789-
"AmazonLinux2",
17901789
"AmazonLinux2023",
1790+
"AmazonLinux2",
17911791
"UbuntuPro2404",
17921792
"Ubuntu2404",
17931793
"UbuntuPro2204",

pkg/apis/eksctl.io/v1alpha5/defaults.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,12 @@ func SetNodeGroupDefaults(ng *NodeGroup, meta *ClusterMeta, controlPlaneOnOutpos
128128
// Set default AMI family depending on Kubernetes version
129129
isAL2EOLVersion, _ := utils.IsMinVersion(AmazonLinux2EOLVersion, meta.Version)
130130
if isAL2EOLVersion {
131-
// For newer Kubernetes versions, default to AL2023
132-
if ng.AMIFamily == "" {
133-
ng.AMIFamily = NodeImageFamilyAmazonLinux2023
134-
}
135131
// Since AL2 isn't supported, throw an error if the user explicitly requested AL2
136132
if ng.AMIFamily == NodeImageFamilyAmazonLinux2 {
137133
return fmt.Errorf("AmazonLinux2 is not supported for Kubernetes version %s", meta.Version)
138134
}
139135
}
140-
// Default to AL2 for Kubernetes versions prior to AmazonLinux2EOLVersion
136+
// Default to AL2023 for all Kubernetes versions.
141137
if ng.AMIFamily == "" {
142138
ng.AMIFamily = DefaultNodeImageFamily
143139
}
@@ -164,22 +160,17 @@ func SetManagedNodeGroupDefaults(ng *ManagedNodeGroup, meta *ClusterMeta, contro
164160
// Thus, we only set up default AMI family when no custom AMI is being used.
165161
isAL2EOLVersion, _ := utils.IsMinVersion(AmazonLinux2EOLVersion, meta.Version)
166162
if ng.AMI == "" && isAL2EOLVersion {
167-
// Set default AMI family depending on Kubernetes version
168-
// For newer Kubernetes versions, default to AL2023
163+
// Default to AL2023 for all Kubernetes versions.
169164
if ng.AMIFamily == "" {
170-
ng.AMIFamily = NodeImageFamilyAmazonLinux2023
165+
ng.AMIFamily = DefaultNodeImageFamily
171166
}
172167
// Since AL2 isn't supported for this K8s version, throw an error if the user explicitly requested AL2
173168
if ng.AMIFamily == NodeImageFamilyAmazonLinux2 {
174169
return fmt.Errorf("AmazonLinux2 is not supported for Kubernetes version %s", meta.Version)
175170
}
176171
} else if ng.AMI == "" && ng.AMIFamily == "" {
177-
// AL2023 is the default ami type on EKS managed nodegroups after 1.30.
178-
if isMinVer, _ := utils.IsMinVersion(Version1_30, meta.Version); isMinVer {
179-
ng.AMIFamily = NodeImageFamilyAmazonLinux2023
180-
} else {
181-
ng.AMIFamily = NodeImageFamilyAmazonLinux2
182-
}
172+
// Default to AL2023 for all Kubernetes versions.
173+
ng.AMIFamily = DefaultNodeImageFamily
183174
}
184175

185176
if ng.Tags == nil {

pkg/apis/eksctl.io/v1alpha5/defaults_test.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,6 @@ var _ = Describe("ClusterConfig validation", func() {
278278

279279
Context("Container Runtime settings", func() {
280280
Context("Kubernetes version 1.23 or lower", func() {
281-
It("defaults to dockerd as a container runtime", func() {
282-
testNodeGroup := NodeGroup{
283-
NodeGroupBase: &NodeGroupBase{},
284-
}
285-
err := SetNodeGroupDefaults(&testNodeGroup, &ClusterMeta{Version: Version1_23}, false)
286-
Expect(err).NotTo(HaveOccurred())
287-
Expect(*testNodeGroup.ContainerRuntime).To(Equal(ContainerRuntimeDockerD))
288-
})
289281
When("ami family is windows", func() {
290282
It("defaults to docker as a container runtime", func() {
291283
testNodeGroup := NodeGroup{
@@ -421,8 +413,8 @@ var _ = Describe("ClusterConfig validation", func() {
421413
Entry("EKS 1.32 uses AL2023", "1.32", NodeImageFamilyAmazonLinux2023),
422414
Entry("EKS 1.31 uses AL2023", "1.31", NodeImageFamilyAmazonLinux2023),
423415
Entry("EKS 1.30 uses AL2023", "1.30", NodeImageFamilyAmazonLinux2023),
424-
Entry("EKS 1.29 uses AL2", "1.29", NodeImageFamilyAmazonLinux2),
425-
Entry("EKS 1.28 uses AL2", "1.28", NodeImageFamilyAmazonLinux2),
416+
Entry("EKS 1.29 uses AL2", "1.29", NodeImageFamilyAmazonLinux2023),
417+
Entry("EKS 1.28 uses AL2", "1.28", NodeImageFamilyAmazonLinux2023),
426418
)
427419
})
428420

@@ -475,7 +467,7 @@ var _ = Describe("ClusterConfig validation", func() {
475467
}
476468
err := SetNodeGroupDefaults(ng, &ClusterMeta{Version: "1.32"}, false)
477469
Expect(err).NotTo(HaveOccurred())
478-
Expect(ng.AMIFamily).To(Equal(NodeImageFamilyAmazonLinux2))
470+
Expect(ng.AMIFamily).To(Equal(NodeImageFamilyAmazonLinux2023))
479471
})
480472
})
481473

@@ -528,7 +520,7 @@ var _ = Describe("ClusterConfig validation", func() {
528520
}
529521
err := SetManagedNodeGroupDefaults(ng, &ClusterMeta{Version: "1.29"}, false)
530522
Expect(err).NotTo(HaveOccurred())
531-
Expect(ng.AMIFamily).To(Equal(NodeImageFamilyAmazonLinux2))
523+
Expect(ng.AMIFamily).To(Equal(NodeImageFamilyAmazonLinux2023))
532524
})
533525
})
534526
})

pkg/apis/eksctl.io/v1alpha5/managed_nodegroup_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package v1alpha5
22

33
import (
4-
"fmt"
5-
64
"github.com/aws/aws-sdk-go-v2/aws"
75
. "github.com/onsi/ginkgo/v2"
86

@@ -59,15 +57,6 @@ var _ = Describe("Managed Nodegroup Validation", func() {
5957
},
6058
errMsg: "when using a custom AMI, amiFamily needs to be explicitly set via config file or via --node-ami-family flag",
6159
}),
62-
Entry("Custom AMI without overrideBootstrapCommand", &nodeGroupCase{
63-
ng: &ManagedNodeGroup{
64-
NodeGroupBase: &NodeGroupBase{
65-
AMI: "ami-custom",
66-
AMIFamily: DefaultNodeImageFamily,
67-
},
68-
},
69-
errMsg: fmt.Sprintf("overrideBootstrapCommand is required when using a custom AMI based on %s", DefaultNodeImageFamily),
70-
}),
7160
Entry("Custom AMI with Windows AMI family without overrideBootstrapCommand", &nodeGroupCase{
7261
ng: &ManagedNodeGroup{
7362
NodeGroupBase: &NodeGroupBase{

pkg/apis/eksctl.io/v1alpha5/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const (
204204
// All valid values of supported families should go in this block
205205
const (
206206
// DefaultNodeImageFamily (default)
207-
DefaultNodeImageFamily = NodeImageFamilyAmazonLinux2
207+
DefaultNodeImageFamily = NodeImageFamilyAmazonLinux2023
208208
NodeImageFamilyAmazonLinux2023 = "AmazonLinux2023"
209209
NodeImageFamilyAmazonLinux2 = "AmazonLinux2"
210210
NodeImageFamilyUbuntuPro2404 = "UbuntuPro2404"

pkg/ctl/cmdutils/filter/nodegroup_filter_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ const expected = `
377377
"nodeGroups": [
378378
{
379379
"name": "test-ng1a",
380-
"amiFamily": "AmazonLinux2",
380+
"amiFamily": "AmazonLinux2023",
381381
"instanceType": "m5.large",
382382
"privateNetworking": false,
383383
"securityGroups": {
@@ -423,7 +423,7 @@ const expected = `
423423
},
424424
{
425425
"name": "test-ng2a",
426-
"amiFamily": "AmazonLinux2",
426+
"amiFamily": "AmazonLinux2023",
427427
"instanceType": "m5.large",
428428
"privateNetworking": false,
429429
"securityGroups": {
@@ -468,7 +468,7 @@ const expected = `
468468
},
469469
{
470470
"name": "test-ng3a",
471-
"amiFamily": "AmazonLinux2",
471+
"amiFamily": "AmazonLinux2023",
472472
"instanceType": "m3.large",
473473
"privateNetworking": false,
474474
"securityGroups": {
@@ -514,7 +514,7 @@ const expected = `
514514
},
515515
{
516516
"name": "test-ng1b",
517-
"amiFamily": "AmazonLinux2",
517+
"amiFamily": "AmazonLinux2023",
518518
"instanceType": "m5.large",
519519
"privateNetworking": false,
520520
"securityGroups": {
@@ -559,7 +559,7 @@ const expected = `
559559
},
560560
{
561561
"name": "test-ng2b",
562-
"amiFamily": "AmazonLinux2",
562+
"amiFamily": "AmazonLinux2023",
563563
"instanceType": "m5.xlarge",
564564
"privateNetworking": false,
565565
"securityGroups": {
@@ -608,7 +608,7 @@ const expected = `
608608
},
609609
{
610610
"name": "test-ng3b",
611-
"amiFamily": "AmazonLinux2",
611+
"amiFamily": "AmazonLinux2023",
612612
"instanceType": "m5.large",
613613
"privateNetworking": false,
614614
"securityGroups": {

pkg/ctl/create/nodegroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
const (
24-
amazonLinux2EndOfSupportWarning = "Amazon EKS will no longer publish EKS-optimized Amazon Linux 2 (AL2) AMIs after November 26th, 2025. Additionally, Kubernetes version 1.32 is the last version for which Amazon EKS will release AL2 AMIs. From version 1.33 onwards, Amazon EKS will continue to release AL2023 and Bottlerocket based AMIs. The default AMI family when creating clusters and nodegroups in Eksctl will be changed to AL2023 in the future."
24+
amazonLinux2EndOfSupportWarning = "Amazon EKS stopped publishing EKS-optimized Amazon Linux 2 (AL2) AMIs on November 26, 2025. AL2023 and Bottlerocket based AMIs for Amazon EKS are available for all supported Kubernetes versions including 1.33 and higher."
2525
)
2626

2727
func createNodeGroupCmd(cmd *cmdutils.Cmd) {

pkg/eks/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ var _ = Describe("eksctl API", func() {
268268

269269
It("should resolve AMI using SSM Parameter Store by default", func() {
270270
provider.MockSSM().On("GetParameter", mock.Anything, &ssm.GetParameterInput{
271-
Name: aws.String("/aws/service/eks/optimized-ami/1.14/amazon-linux-2/recommended/image_id"),
271+
Name: aws.String("/aws/service/eks/optimized-ami/1.14/amazon-linux-2023/x86_64/standard/recommended/image_id"),
272272
}).Return(&ssm.GetParameterOutput{
273273
Parameter: &ssmtypes.Parameter{
274274
Value: aws.String("ami-ssm"),

0 commit comments

Comments
 (0)