Repository navigation
Add support for AmazonLinux2027 #8920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
maitreya526
wants to merge
4
commits into
eksctl-io:main
Choose a base branch
from
maitreya526:feature/al2027-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+419
−32
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aa69ba1
Add support for AmazonLinux2027 custom AMIs
maitreya526 0af9717
Add SSM lookup, managed nodegroups and InstanceIdNodeName for AL2027
maitreya526 678d581
Rename the AL2023 bootstrapper to Nodeadm
maitreya526 b3a866d
Clarify AmazonLinux2027 docs for managed nodegroups and ami: auto
maitreya526 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package accessentry | ||
|
|
||
| import ( | ||
| . "github.com/onsi/ginkgo/v2" | ||
| . "github.com/onsi/gomega" | ||
|
|
||
| "github.com/weaveworks/eksctl/pkg/authconfigmap" | ||
| "github.com/weaveworks/eksctl/pkg/iam" | ||
| ) | ||
|
|
||
| // {{SessionName}} mappings are shared by Fargate, hybrid and AmazonLinux2027 nodes, so their access entry type is unknown. | ||
| var _ = DescribeTable("Migrate {{SessionName}} iamidentitymapping", func(groups []string) { | ||
| identity, err := iam.NewIdentity("arn:aws:iam::111122223333:role/test", authconfigmap.RoleNodeGroupUsernameInstanceID, groups) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| entries, skipAPIMode := doFilterAccessEntries([]iam.Identity{identity}, nil) | ||
| Expect(entries).To(BeEmpty()) | ||
| Expect(skipAPIMode).To(BeTrue()) | ||
| }, | ||
| Entry("Fargate pod execution role", []string{"system:bootstrappers", "system:nodes", "system:node-proxier"}), | ||
| Entry("hybrid nodes or AmazonLinux2027 node role", authconfigmap.RoleNodeGroupGroups), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| package v1alpha5_test | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/aws/aws-sdk-go-v2/aws" | ||
| . "github.com/onsi/ginkgo/v2" | ||
| . "github.com/onsi/gomega" | ||
|
|
||
| api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5" | ||
| ) | ||
|
|
||
| // instanceIDNodeNameConfig returns a nodeadm NodeConfig that sets the InstanceIdNodeName feature gate. | ||
| func instanceIDNodeNameConfig(enabled bool) *string { | ||
| return aws.String(fmt.Sprintf(`apiVersion: node.eks.aws/v1alpha1 | ||
| kind: NodeConfig | ||
| spec: | ||
| featureGates: | ||
| InstanceIdNodeName: %t | ||
| `, enabled)) | ||
| } | ||
|
|
||
| var _ = Describe("AmazonLinux2027", func() { | ||
| It("is a supported AMI family", func() { | ||
| Expect(api.SupportedAMIFamilies()).To(ContainElement(api.NodeImageFamilyAmazonLinux2027)) | ||
| }) | ||
|
|
||
| DescribeTable("IsNodeadmImage", func(amiFamily string, expected bool) { | ||
| Expect(api.IsNodeadmImage(amiFamily)).To(Equal(expected)) | ||
| }, | ||
| Entry(api.NodeImageFamilyAmazonLinux2027, api.NodeImageFamilyAmazonLinux2027, true), | ||
| Entry(api.NodeImageFamilyAmazonLinux2023, api.NodeImageFamilyAmazonLinux2023, true), | ||
| Entry(api.NodeImageFamilyAmazonLinux2, api.NodeImageFamilyAmazonLinux2, false), | ||
| Entry(api.NodeImageFamilyBottlerocket, api.NodeImageFamilyBottlerocket, false), | ||
| ) | ||
|
|
||
| DescribeTable("node name and access entry type", func(amiFamily string, overrideBootstrapCommand *string, usesInstanceIDNodeName bool, expectedType api.AccessEntryType) { | ||
| ng := api.NewNodeGroup() | ||
| ng.AMIFamily = amiFamily | ||
| ng.OverrideBootstrapCommand = overrideBootstrapCommand | ||
| Expect(api.UsesInstanceIDNodeName(ng.NodeGroupBase)).To(Equal(usesInstanceIDNodeName)) | ||
| Expect(api.GetAccessEntryType(ng)).To(Equal(expectedType)) | ||
| }, | ||
| Entry("AmazonLinux2027 by default", api.NodeImageFamilyAmazonLinux2027, (*string)(nil), true, api.AccessEntryTypeEC2), | ||
| Entry("AmazonLinux2027 with InstanceIdNodeName off", api.NodeImageFamilyAmazonLinux2027, instanceIDNodeNameConfig(false), false, api.AccessEntryTypeLinux), | ||
| Entry("AmazonLinux2027 with a NodeConfig that doesn't set InstanceIdNodeName", api.NodeImageFamilyAmazonLinux2027, | ||
| aws.String("apiVersion: node.eks.aws/v1alpha1\nkind: NodeConfig\nspec:\n instance:\n localStorage:\n strategy: RAID0\n"), true, api.AccessEntryTypeEC2), | ||
| Entry("AmazonLinux2023 by default", api.NodeImageFamilyAmazonLinux2023, (*string)(nil), false, api.AccessEntryTypeLinux), | ||
| Entry("AmazonLinux2023 with InstanceIdNodeName on", api.NodeImageFamilyAmazonLinux2023, instanceIDNodeNameConfig(true), true, api.AccessEntryTypeEC2), | ||
| Entry("AmazonLinux2 ignores overrideBootstrapCommand", api.NodeImageFamilyAmazonLinux2, aws.String("/etc/eks/bootstrap.sh my-cluster"), false, api.AccessEntryTypeLinux), | ||
| Entry("Windows", api.NodeImageFamilyWindowsServer2022CoreContainer, (*string)(nil), false, api.AccessEntryTypeWindows), | ||
| ) | ||
|
|
||
| Describe("self-managed nodegroups", func() { | ||
| var ( | ||
| cfg *api.ClusterConfig | ||
| ng *api.NodeGroup | ||
| ) | ||
|
|
||
| BeforeEach(func() { | ||
| cfg = api.NewClusterConfig() | ||
| ng = cfg.NewNodeGroup() | ||
| ng.AMIFamily = api.NodeImageFamilyAmazonLinux2027 | ||
| }) | ||
|
|
||
| DescribeTable("accepts nodegroups without an AMI ID, as eksctl looks up the AMI", func(ami string) { | ||
| ng.AMI = ami | ||
| Expect(api.ValidateNodeGroup(0, ng, cfg)).To(Succeed()) | ||
| }, | ||
| Entry("ami not set", ""), | ||
| Entry("ami is auto-ssm", api.NodeImageResolverAutoSSM), | ||
| ) | ||
|
|
||
| It("accepts an AMI ID without overrideBootstrapCommand", func() { | ||
| ng.AMI = "ami-0123456789abcdef0" | ||
| Expect(api.ValidateNodeGroup(0, ng, cfg)).To(Succeed()) | ||
| }) | ||
|
|
||
| It("accepts the InstanceIdNodeName feature gate in overrideBootstrapCommand", func() { | ||
| ng.AMI = "ami-0123456789abcdef0" | ||
| ng.OverrideBootstrapCommand = instanceIDNodeNameConfig(false) | ||
| Expect(api.ValidateNodeGroup(0, ng, cfg)).To(Succeed()) | ||
| }) | ||
|
|
||
| It("rejects the dockerd container runtime", func() { | ||
| ng.AMI = "ami-0123456789abcdef0" | ||
| ng.ContainerRuntime = aws.String(api.ContainerRuntimeDockerD) | ||
| Expect(api.ValidateNodeGroup(0, ng, cfg)).To(MatchError(ContainSubstring(fmt.Sprintf("only %s is supported for container runtime on %s nodes", api.ContainerRuntimeContainerD, api.NodeImageFamilyAmazonLinux2027)))) | ||
| }) | ||
|
|
||
| It("defaults the container runtime to containerd", func() { | ||
| ng.AMI = "ami-0123456789abcdef0" | ||
| Expect(api.SetNodeGroupDefaults(ng, &api.ClusterMeta{Version: api.Version1_23}, false)).To(Succeed()) | ||
| Expect(*ng.ContainerRuntime).To(Equal(api.ContainerRuntimeContainerD)) | ||
| }) | ||
| }) | ||
|
|
||
| DescribeTable("managed nodegroups", func(updateMNG func(*api.ManagedNodeGroup), expectedErr string) { | ||
| mng := api.NewManagedNodeGroup() | ||
| mng.AMIFamily = api.NodeImageFamilyAmazonLinux2027 | ||
| mng.AMI = "ami-0123456789abcdef0" | ||
| updateMNG(mng) | ||
| err := api.ValidateManagedNodeGroup(0, mng) | ||
| if expectedErr == "" { | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| } else { | ||
| Expect(err).To(MatchError(ContainSubstring(expectedErr))) | ||
| } | ||
| }, | ||
| Entry("rejects instance ID node names by default", func(*api.ManagedNodeGroup) {}, "nodes named by EC2 instance ID can't join yet"), | ||
| Entry("rejects a lowercase AMI family", func(mng *api.ManagedNodeGroup) { | ||
| mng.AMIFamily = "amazonlinux2027" | ||
| }, "nodes named by EC2 instance ID can't join yet"), | ||
| Entry("rejects InstanceIdNodeName turned on", func(mng *api.ManagedNodeGroup) { | ||
| mng.OverrideBootstrapCommand = instanceIDNodeNameConfig(true) | ||
| }, "nodes named by EC2 instance ID can't join yet"), | ||
| Entry("accepts InstanceIdNodeName turned off", func(mng *api.ManagedNodeGroup) { | ||
| mng.OverrideBootstrapCommand = instanceIDNodeNameConfig(false) | ||
| }, ""), | ||
| ) | ||
|
|
||
| It("allows an AmazonLinux2027 managed nodegroup with a launch template, which sets its own node config", func() { | ||
| mng := api.NewManagedNodeGroup() | ||
| mng.AMIFamily = api.NodeImageFamilyAmazonLinux2027 | ||
| // A launch template nodegroup must not set these fields; the template provides them. | ||
| mng.VolumeSize = nil | ||
| mng.VolumeType = nil | ||
| mng.LaunchTemplate = &api.LaunchTemplate{ID: "lt-1234"} | ||
| Expect(api.ValidateManagedNodeGroup(0, mng)).To(Succeed()) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: If you are using
IsNodeadmImagein places other thanvalidation.go, then I don't think it belongs invalidation.go. Is there a utilities/library file in this package? If not,defaults.goseems better.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept
IsNodeadmImageinvalidation.gonext to its siblingIs*Imagehelpers (IsAmazonLinuxImage,IsBottlerocketImage,IsWindowsImage, ...) for consistency. Some of those, likeIsWindowsImageandIsBottlerocketImage, are already used outsidevalidation.gotoo. Happy to move them together in a follow-up if you'd prefer.