Skip to content

Commit

Permalink
Remove support for deprecated Ubuntu 18.04
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs committed Jan 21, 2025
1 parent 18394bd commit f182c45
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 65 deletions.
5 changes: 1 addition & 4 deletions pkg/ami/auto_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ func MakeImageSearchPatterns(version string) map[string]map[int]string {
ImageClassGeneral: fmt.Sprintf("ubuntu-eks/k8s_%s/images/*20.04-amd64*", version),
ImageClassARM: fmt.Sprintf("ubuntu-eks/k8s_%s/images/*20.04-arm64*", version),
},
api.NodeImageFamilyUbuntu1804: {
ImageClassGeneral: fmt.Sprintf("ubuntu-eks/k8s_%s/images/*18.04*", version),
},
api.NodeImageFamilyWindowsServer2019CoreContainer: {
ImageClassGeneral: fmt.Sprintf("Windows_Server-2019-English-Core-EKS_Optimized-%v-*", version),
},
Expand All @@ -76,7 +73,7 @@ func MakeImageSearchPatterns(version string) map[string]map[int]string {
// OwnerAccountID returns the AWS account ID that owns worker AMI.
func OwnerAccountID(imageFamily, region string) (string, error) {
switch imageFamily {
case api.NodeImageFamilyUbuntuPro2404, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntu2004, api.NodeImageFamilyUbuntu1804:
case api.NodeImageFamilyUbuntuPro2404, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntu2004:
return ownerIDUbuntuFamily, nil
case api.NodeImageFamilyAmazonLinux2023, api.NodeImageFamilyAmazonLinux2:
return api.EKSResourceAccountID(region), nil
Expand Down
8 changes: 4 additions & 4 deletions pkg/ami/auto_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ var _ = Describe("AMI Auto Resolution", func() {
})

It("should return the AWS Account ID for Ubuntu images in ap-east-1", func() {
ownerAccount, err := OwnerAccountID(api.NodeImageFamilyUbuntu1804, "ap-east-1")
ownerAccount, err := OwnerAccountID(api.NodeImageFamilyUbuntu2004, "ap-east-1")
Expect(ownerAccount).To(BeEquivalentTo("099720109477"))
Expect(err).NotTo(HaveOccurred())
})

It("should return the Ubuntu Account ID for Ubuntu images", func() {
ownerAccount, err := OwnerAccountID(api.NodeImageFamilyUbuntu1804, region)
ownerAccount, err := OwnerAccountID(api.NodeImageFamilyUbuntu2004, region)
Expect(ownerAccount).To(BeEquivalentTo("099720109477"))
Expect(err).NotTo(HaveOccurred())
})
Expand Down Expand Up @@ -130,10 +130,10 @@ var _ = Describe("AMI Auto Resolution", func() {
Context("and ami is available", func() {
BeforeEach(func() {
imageState = ec2types.ImageStateAvailable
imageFamily = "Ubuntu1804"
imageFamily = "Ubuntu2204"

p = mockprovider.NewMockProvider()
addMockDescribeImages(p, "ubuntu-eks/k8s_1.15/images/*18.04*", expectedAmi, imageState, "2018-08-20T23:25:53.000Z", api.NodeImageFamilyUbuntu1804)
addMockDescribeImages(p, "ubuntu-eks/k8s_1.29/images/*22.04*", expectedAmi, imageState, "2024-12-09T00:00:26.000Z", api.NodeImageFamilyUbuntu2204)

resolver := NewAutoResolver(p.MockEC2())
resolvedAmi, err = resolver.Resolve(context.Background(), region, version, instanceType, imageFamily)
Expand Down
4 changes: 1 addition & 3 deletions pkg/ami/ssm_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ func MakeSSMParameterName(version, instanceType, imageFamily string) (string, er
return fmt.Sprintf("/aws/service/ami-windows-latest/Windows_Server-2022-English-%s-EKS_Optimized-%s/%s", windowsAmiType(imageFamily), version, fieldName), nil
case api.NodeImageFamilyBottlerocket:
return fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s/%s/latest/%s", imageType(imageFamily, instanceType, version), instanceEC2ArchName(instanceType), fieldName), nil
case api.NodeImageFamilyUbuntu1804:
return "", &UnsupportedQueryError{msg: fmt.Sprintf("SSM Parameter lookups for %s AMIs is not supported", imageFamily)}
case api.NodeImageFamilyUbuntu2004,
api.NodeImageFamilyUbuntu2204,
api.NodeImageFamilyUbuntuPro2204:
Expand Down Expand Up @@ -190,7 +188,7 @@ func ubuntuReleaseName(imageFamily string) string {
case api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2404:
return "24.04"
default:
return "18.04"
return "20.04"
}
}

Expand Down
17 changes: 0 additions & 17 deletions pkg/ami/ssm_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,6 @@ var _ = Describe("AMI Auto Resolution", func() {

})

Context("and Ubuntu1804 family", func() {
BeforeEach(func() {
p = mockprovider.NewMockProvider()
instanceType = "t2.medium"
imageFamily = "Ubuntu1804"
})

It("should return an error", func() {
resolver := NewSSMResolver(p.MockSSM())
resolvedAmi, err = resolver.Resolve(context.Background(), region, version, instanceType, imageFamily)

Expect(err).To(HaveOccurred())
Expect(err).To(MatchError("SSM Parameter lookups for Ubuntu1804 AMIs is not supported"))
})

})

Context("and Ubuntu2004 family", func() {
BeforeEach(func() {
p = mockprovider.NewMockProvider()
Expand Down
10 changes: 4 additions & 6 deletions pkg/apis/eksctl.io/v1alpha5/assets/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1341,8 +1341,8 @@
},
"amiFamily": {
"type": "string",
"description": "Valid variants are: `\"AmazonLinux2\"` (default), `\"AmazonLinux2023\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"Ubuntu2004\"`, `\"Ubuntu1804\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
"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;Ubuntu2004&quot;</code>, <code>&quot;Ubuntu1804&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>.",
"description": "Valid variants are: `\"AmazonLinux2\"` (default), `\"AmazonLinux2023\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"Ubuntu2004\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
"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;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>.",
"default": "AmazonLinux2",
"enum": [
"AmazonLinux2",
Expand All @@ -1352,7 +1352,6 @@
"UbuntuPro2204",
"Ubuntu2204",
"Ubuntu2004",
"Ubuntu1804",
"Bottlerocket",
"WindowsServer2019CoreContainer",
"WindowsServer2019FullContainer",
Expand Down Expand Up @@ -1684,8 +1683,8 @@
},
"amiFamily": {
"type": "string",
"description": "Valid variants are: `\"AmazonLinux2\"` (default), `\"AmazonLinux2023\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"Ubuntu2004\"`, `\"Ubuntu1804\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
"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;Ubuntu2004&quot;</code>, <code>&quot;Ubuntu1804&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>.",
"description": "Valid variants are: `\"AmazonLinux2\"` (default), `\"AmazonLinux2023\"`, `\"UbuntuPro2404\"`, `\"Ubuntu2404\"`, `\"UbuntuPro2204\"`, `\"Ubuntu2204\"`, `\"Ubuntu2004\"`, `\"Bottlerocket\"`, `\"WindowsServer2019CoreContainer\"`, `\"WindowsServer2019FullContainer\"`, `\"WindowsServer2022CoreContainer\"`, `\"WindowsServer2022FullContainer\"`.",
"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;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>.",
"default": "AmazonLinux2",
"enum": [
"AmazonLinux2",
Expand All @@ -1695,7 +1694,6 @@
"UbuntuPro2204",
"Ubuntu2204",
"Ubuntu2004",
"Ubuntu1804",
"Bottlerocket",
"WindowsServer2019CoreContainer",
"WindowsServer2019FullContainer",
Expand Down
10 changes: 0 additions & 10 deletions pkg/apis/eksctl.io/v1alpha5/gpu_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ var _ = Describe("GPU instance support", func() {
gpuInstanceType: "g5.12xlarge",
amiFamily: api.NodeImageFamilyAmazonLinux2,
}),
Entry("Ubuntu1804", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyUbuntu2004,
gpuInstanceType: "g4dn.xlarge",
}),
Entry("Ubuntu2004", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyUbuntu2004,
gpuInstanceType: "g4dn.xlarge",
Expand Down Expand Up @@ -226,11 +222,6 @@ var _ = Describe("GPU instance support", func() {
},
expectWarning: true,
}),
Entry("Ubuntu with explicit GPU instance", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyUbuntu1804,
gpuInstanceType: "g4dn.xlarge",
expectWarning: true,
}),
Entry("Ubuntu with implicit GPU instance", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyUbuntu2004,
instanceSelector: &api.InstanceSelector{
Expand All @@ -254,7 +245,6 @@ var _ = Describe("GPU instance support", func() {
},
Entry("AmazonLinux2", api.NodeImageFamilyAmazonLinux2, true),
Entry("Ubuntu2004", api.NodeImageFamilyUbuntu2004, true),
Entry("Ubuntu1804", api.NodeImageFamilyUbuntu1804, true),
Entry("Windows2019Full", api.NodeImageFamilyWindowsServer2019FullContainer, true),
Entry("Windows2019Core", api.NodeImageFamilyWindowsServer2019CoreContainer, true),
Entry("Bottlerocket", api.NodeImageFamilyBottlerocket, false),
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/eksctl.io/v1alpha5/outposts_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ var _ = Describe("Outposts validation", func() {
},
Entry("AmazonLinux2", api.NodeImageFamilyAmazonLinux2, false),
Entry("Bottlerocket", api.NodeImageFamilyBottlerocket, true),
Entry("Ubuntu1804", api.NodeImageFamilyUbuntu1804, true),
Entry("Ubuntu2004", api.NodeImageFamilyUbuntu2004, true),
Entry("Ubuntu2204", api.NodeImageFamilyUbuntu2204, true),
Entry("UbuntuPro2204", api.NodeImageFamilyUbuntuPro2204, true),
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/eksctl.io/v1alpha5/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ const (
NodeImageFamilyUbuntuPro2204 = "UbuntuPro2204"
NodeImageFamilyUbuntu2204 = "Ubuntu2204"
NodeImageFamilyUbuntu2004 = "Ubuntu2004"
NodeImageFamilyUbuntu1804 = "Ubuntu1804"
NodeImageFamilyBottlerocket = "Bottlerocket"

NodeImageFamilyWindowsServer2019CoreContainer = "WindowsServer2019CoreContainer"
Expand Down Expand Up @@ -530,7 +529,6 @@ func SupportedAMIFamilies() []string {
NodeImageFamilyUbuntuPro2204,
NodeImageFamilyUbuntu2204,
NodeImageFamilyUbuntu2004,
NodeImageFamilyUbuntu1804,
NodeImageFamilyBottlerocket,
NodeImageFamilyWindowsServer2019CoreContainer,
NodeImageFamilyWindowsServer2019FullContainer,
Expand Down
3 changes: 1 addition & 2 deletions pkg/apis/eksctl.io/v1alpha5/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1565,8 +1565,7 @@ func IsUbuntuImage(imageFamily string) bool {
NodeImageFamilyUbuntu2404,
NodeImageFamilyUbuntuPro2204,
NodeImageFamilyUbuntu2204,
NodeImageFamilyUbuntu2004,
NodeImageFamilyUbuntu1804:
NodeImageFamilyUbuntu2004:
return true

default:
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/eksctl.io/v1alpha5/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2167,10 +2167,6 @@ var _ = Describe("ClusterConfig validation", func() {
err := api.ValidateManagedNodeGroup(0, mng)
Expect(err).NotTo(HaveOccurred())

mng.AMIFamily = api.NodeImageFamilyUbuntu1804
err = api.ValidateManagedNodeGroup(0, mng)
Expect(err).NotTo(HaveOccurred())

mng.AMIFamily = api.NodeImageFamilyUbuntu2004
err = api.ValidateManagedNodeGroup(0, mng)
Expect(err).NotTo(HaveOccurred())
Expand Down
8 changes: 0 additions & 8 deletions pkg/eks/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,6 @@ var _ = Describe("eksctl API", func() {
testEnsureAMI(Equal("ami-ssm"), "1.14")
})

It("should fall back to auto resolution for Ubuntu1804", func() {
ng.AMIFamily = api.NodeImageFamilyUbuntu1804
mockDescribeImages(provider, "ami-ubuntu", func(input *ec2.DescribeImagesInput) bool {
return input.Owners[0] == "099720109477"
})
testEnsureAMI(Equal("ami-ubuntu"), "1.14")
})

It("should fall back to auto resolution for Ubuntu2004 on 1.14", func() {
ng.AMIFamily = api.NodeImageFamilyUbuntu2004
mockDescribeImages(provider, "ami-ubuntu", func(input *ec2.DescribeImagesInput) bool {
Expand Down
4 changes: 2 additions & 2 deletions pkg/nodebootstrap/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewBootstrapper(clusterConfig *api.ClusterConfig, ng *api.NodeGroup) (Boots
return NewWindowsBootstrapper(clusterConfig, ng, clusterDNS), nil
}
switch ng.AMIFamily {
case api.NodeImageFamilyUbuntuPro2404, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntu2004, api.NodeImageFamilyUbuntu1804:
case api.NodeImageFamilyUbuntuPro2404, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntu2004:
return NewUbuntuBootstrapper(clusterConfig, ng, clusterDNS), nil
case api.NodeImageFamilyBottlerocket:
return NewBottlerocketBootstrapper(clusterConfig, ng), nil
Expand Down Expand Up @@ -80,7 +80,7 @@ func NewManagedBootstrapper(clusterConfig *api.ClusterConfig, ng *api.ManagedNod
return NewManagedAL2Bootstrapper(ng), nil
case api.NodeImageFamilyBottlerocket:
return NewManagedBottlerocketBootstrapper(clusterConfig, ng), nil
case api.NodeImageFamilyUbuntu1804, api.NodeImageFamilyUbuntu2004, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2404:
case api.NodeImageFamilyUbuntu2004, api.NodeImageFamilyUbuntu2204, api.NodeImageFamilyUbuntuPro2204, api.NodeImageFamilyUbuntu2404, api.NodeImageFamilyUbuntuPro2404:
return NewUbuntuBootstrapper(clusterConfig, ng, clusterDNS), nil
}
return nil, nil
Expand Down
3 changes: 1 addition & 2 deletions userdocs/src/usage/custom-ami-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ The `--node-ami-family` can take following keywords:
|--------------------------------|:------------------------------------------------------------------------------------------------------------------:|
| AmazonLinux2 | Indicates that the EKS AMI image based on Amazon Linux 2 should be used (default). |
| AmazonLinux2023 | Indicates that the EKS AMI image based on Amazon Linux 2023 should be used. |
| Ubuntu1804 | Indicates that the EKS AMI image based on Ubuntu 18.04 LTS (Bionic) should be used. |
| Ubuntu2004 | Indicates that the EKS AMI image based on Ubuntu 20.04 LTS (Focal) should be used (supported for EKS <= 1.29). |
| Ubuntu2204 | Indicates that the EKS AMI image based on Ubuntu 22.04 LTS (Jammy) should be used (available for EKS >= 1.29). |
| UbuntuPro2204 | Indicates that the EKS AMI image based on Ubuntu Pro 22.04 LTS (Jammy) should be used (available for EKS >= 1.29). |
Expand Down Expand Up @@ -89,7 +88,7 @@ managedNodeGroups:
The `--node-ami-family` flag can also be used with `eksctl create nodegroup`. `eksctl` requires AMI Family to be explicitly set via config file or via `--node-ami-family` CLI flag, whenever working with a custom AMI.

???+ note
At the moment, EKS managed nodegroups only support the following AMI Families when working with custom AMIs: `AmazonLinux2023`, `AmazonLinux2`, `Ubuntu1804`, `Ubuntu2004`, `Ubuntu2204` and `Ubuntu2404`
At the moment, EKS managed nodegroups only support the following AMI Families when working with custom AMIs: `AmazonLinux2023`, `AmazonLinux2`, `Ubuntu2004`, `Ubuntu2204` and `Ubuntu2404`

## Windows custom AMI support
Only self-managed Windows nodegroups can specify a custom AMI. `amiFamily` should be set to a valid Windows AMI family.
Expand Down

0 comments on commit f182c45

Please # to comment.