Repository navigation
Add support for AmazonLinux2027 - #8920
maitreya526 wants to merge 4 commits into
Conversation
AmazonLinux2027 nodes are named by EC2 instance ID, so the EC2_LINUX
access entry and the {{EC2PrivateDNSName}} aws-auth username eksctl
uses don't match and the nodes are rejected. Add an AmazonLinux2027
family for self-managed nodegroups that uses an EC2 access entry or a
{{SessionName}} aws-auth mapping, reuses the AmazonLinux2023 nodeadm
user data, and requires an AMI ID. Managed nodegroups are rejected
until EKS supports AmazonLinux2027.
|
Hello maitreya526 👋 Thank you for opening a Pull Request in |
| @@ -43,8 +43,20 @@ const ( | |||
| // RoleNodeGroupUsername is the default username for a nodegroup | |||
| // role mapping. | |||
| RoleNodeGroupUsername = "system:node:{{EC2PrivateDNSName}}" | |||
There was a problem hiding this comment.
non-blocking: you may want to rename this.
There was a problem hiding this comment.
RoleNodeGroupUsername existed before this PR. It's exported and also used by the Karpenter and access entry migrator code. I'll rename it in a follow-up PR to keep this one focused.
| normalizeAMIFamily(ng.BaseNodeGroup()) | ||
| path := fmt.Sprintf("managedNodeGroups[%d]", index) | ||
|
|
||
| // EKS creates managed node access entries as EC2_LINUX, which doesn't match AmazonLinux2027 instance ID node names. |
There was a problem hiding this comment.
On behalf node-runtime/AL2027 project, I'm fine with not enforcing this validation. It will make things once we have the SSM params in 1-2 weeks. But of course, eksctl maintainers' preference takes precedence.
There was a problem hiding this comment.
I tested this, and since EKS creates the access entry for AL2027 managed nodegroups as EC2_LINUX, nodes with instance ID names never joined (details in the test results in the description). So instead of rejecting all AL2027 managed nodegroups, I've narrowed the check to only reject the ones that would use instance ID names. Nodegroups with InstanceIdNodeName: false are allowed. Happy to change this based on what the eksctl maintainers prefer.
| return | ||
| } | ||
|
|
||
| if ng.AMIFamily == NodeImageFamilyAmazonLinux2023 { |
There was a problem hiding this comment.
nit: If you are using IsNodeadmImage in places other than validation.go, then I don't think it belongs in validation.go. Is there a utilities/library file in this package? If not, defaults.go seems better.
There was a problem hiding this comment.
I kept IsNodeadmImage in validation.go next to its sibling Is*Image helpers (IsAmazonLinuxImage, IsBottlerocketImage, IsWindowsImage, ...) for consistency. Some of those, like IsWindowsImage and IsBottlerocketImage, are already used outside validation.go too. Happy to move them together in a follow-up if you'd prefer.
| } | ||
|
|
||
| // UsesInstanceIDNodeName reports whether nodes of the AMI family are named by EC2 instance ID. | ||
| func UsesInstanceIDNodeName(amiFamily string) bool { |
There was a problem hiding this comment.
nit: function seems redundant.
There was a problem hiding this comment.
It now reads the InstanceIdNodeName feature gate from overrideBootstrapCommand, so the access entry, aws-auth username and managed nodegroup check all follow the same setting.
Pick the access entry type and aws-auth username from the nodeadm InstanceIdNodeName feature gate, which defaults to on for AmazonLinux2027. Look up AmazonLinux2027 AMIs from SSM, like AmazonLinux2023. Allow AmazonLinux2027 managed nodegroups, except with instance ID node names, as EKS creates their access entry as EC2_LINUX.
AmazonLinux2023 and AmazonLinux2027 both use it, so name it after nodeadm instead of AmazonLinux2023.
Add a managedNodeGroups example with the InstanceIdNodeName feature gate turned off, and list what isn't supported for AmazonLinux2027 yet.
Description
Adds an
AmazonLinux2027AMI family for the AmazonLinux2027 EKS AMI preview.AmazonLinux2027 nodes are named by EC2 instance ID by default (the nodeadm
InstanceIdNodeNamefeature gate), but eksctl always gave self-managed Linux nodes anEC2_LINUXaccess entry, which expects private DNS names, so these nodes were rejected.The new family reuses the AmazonLinux2023 nodeadm user data (the bootstrapper is renamed to
Nodeadmin a separate commit), only supports containerd, and looks up AMIs from the public SSM parameters. The access entry type and aws-auth username now follow theInstanceIdNodeNamefeature gate inoverrideBootstrapCommand:EC2/system:node:{{SessionName}}for instance ID names, as described in the EKS docs, andEC2_LINUX/system:node:{{EC2PrivateDNSName}}otherwise. Managed nodegroups are supported, but EKS creates their access entry asEC2_LINUX, so eksctl rejects AmazonLinux2027 managed nodegroups that would use instance ID names.eksctl utils migrate-to-access-entrystill skipssystem:node:{{SessionName}}mappings, as Fargate and hybrid node roles use the same username.Go API change: the exported
nodebootstrap.AL2023,NewAL2023BootstrapperandNewManagedAL2023Bootstrapperare renamed toNodeadm,NewNodeadmBootstrapperandNewManagedNodeadmBootstrapper. This only affects code that imports eksctl as a library.ami: auto, GPU/Neuron (driver warnings, Inferentia/Trainium checks, NVIDIA device plugin) and Outposts don't support AmazonLinux2027 yet. arm64 isn't tested, as the preview only has an x86_64 AMI.Testing
Unit tests cover the access entry type, aws-auth username, feature gate, validation, user data, SSM path and migrator.
Manual tests on a 1.37 cluster with the preview AMI
ami-0ad72f625c44b33e3(us-west-2):i-...EC2InstanceIdNodeName: falseip-...EC2_LINUXInstanceIdNodeName: falseip-...EC2_LINUX, created by EKSInstanceIdNodeName: truei-...EC2amiParameterNotFound, as expected (not published yet)The aws-auth path is covered by unit tests. A
system:node:{{SessionName}}aws-auth mapping was also tested by hand on the same cluster, and the node joined.Checklist
README.md, or theuserdocsdirectory)area/nodegroup) and kind (e.g.kind/improvement)