eksctl
eksctl copied to clipboard
[Bug] Panic on setting bottlerocket nodegroup
What were you trying to accomplish?
I wanted to create a new nodegroup using bottlerocket nodes for my cluster. I am hitting a panic:
❯ eksctl create nodegroup --cluster unique-hideout-1663015504 --managed --node-ami-family BOTTLEROCKET
2022-09-14 11:06:11 [ℹ] will use version 1.22 for new nodegroup(s) based on control plane version
2022-09-14 11:06:12 [ℹ] nodegroup "ng-4c294288" will use "" [Bottlerocket/1.22]
2022-09-14 11:06:12 [ℹ] 1 existing nodegroup(s) (ng-4c560683) will be excluded
2022-09-14 11:06:12 [ℹ] 1 nodegroup (ng-4c294288) was included (based on the include/exclude rules)
2022-09-14 11:06:12 [ℹ] will create a CloudFormation stack for each of 1 managed nodegroups in cluster "unique-hideout-1663015504"
2022-09-14 11:06:12 [ℹ]
2 sequential tasks: { fix cluster compatibility, 1 task: { 1 task: { create managed nodegroup "ng-4c294288" } }
}
2022-09-14 11:06:12 [ℹ] checking cluster stack for missing resources
2022-09-14 11:06:12 [ℹ] cluster stack has all required resources
2022-09-14 11:06:12 [ℹ] building managed nodegroup stack "eksctl-unique-hideout-1663015504-nodegroup-ng-4c294288"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x256b944]
goroutine 219 [running]:
github.com/weaveworks/eksctl/pkg/nodebootstrap.extractKubernetesSettings({0x4acff28?, 0x400079e770?})
github.com/weaveworks/eksctl/pkg/nodebootstrap/bottlerocket.go:82 +0x34
github.com/weaveworks/eksctl/pkg/nodebootstrap.(*ManagedBottlerocket).setDerivedSettings(0x4000e7f230)
github.com/weaveworks/eksctl/pkg/nodebootstrap/managed_bottlerocket.go:60 +0x30
github.com/weaveworks/eksctl/pkg/nodebootstrap.(*ManagedBottlerocket).UserData(0x4000e7f230)
github.com/weaveworks/eksctl/pkg/nodebootstrap/managed_bottlerocket.go:27 +0x24
github.com/weaveworks/eksctl/pkg/cfn/builder.(*ManagedNodeGroupResourceSet).makeLaunchTemplateData(0x40011443c0, {0x4adc710, 0x4000226000})
github.com/weaveworks/eksctl/pkg/cfn/builder/managed_launch_template.go:39 +0x35c
github.com/weaveworks/eksctl/pkg/cfn/builder.(*ManagedNodeGroupResourceSet).AddAllResources(0x40011443c0, {0x4adc710, 0x4000226000})
github.com/weaveworks/eksctl/pkg/cfn/builder/managed_nodegroup.go:164 +0xe54
github.com/weaveworks/eksctl/pkg/cfn/manager.(*StackCollection).createManagedNodeGroupTask(0x400026a6e0, {0x4adc710, 0x4000226000}, 0x0?, 0x400079e770, 0x1, {0x4ae2cc8?, 0x400100a3f0})
github.com/weaveworks/eksctl/pkg/cfn/manager/nodegroup.go:74 +0x740
github.com/weaveworks/eksctl/pkg/cfn/manager.(*managedNodeGroupTask).Do(0x425e3ba?, 0x0?)
github.com/weaveworks/eksctl/pkg/cfn/manager/tasks.go:55 +0x48
github.com/weaveworks/eksctl/pkg/utils/tasks.doSingleTask(0x0?, {0x4ac9008, 0x40006be140})
github.com/weaveworks/eksctl/pkg/utils/tasks/tasks.go:189 +0xd8
github.com/weaveworks/eksctl/pkg/utils/tasks.doSequentialTasks(0x0?, {0x400100a410, 0x1, 0x0?})
github.com/weaveworks/eksctl/pkg/utils/tasks/tasks.go:219 +0x70
created by github.com/weaveworks/eksctl/pkg/utils/tasks.(*TaskTree).Do
github.com/weaveworks/eksctl/pkg/utils/tasks/tasks.go:149 +0x1cc
What happened?
I am getting a panic
How to reproduce it?
- Create a new cluster:
❯ eksctl create cluster
- Create a bottlerocket nodegroup using the new cluster's name, see the panic:
❯ eksctl create nodegroup --cluster <name-of-cluster> --managed --node-ami-family BOTTLEROCKET
Versions
❯ eksctl info
eksctl version: 0.109.0
kubectl version: v1.24.3
OS: linux
Hello jpmcb :wave: Thank you for opening an issue in eksctl project. The team will review the issue and aim to respond within 1-3 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines here. You can find out more information about eksctl on our website
Looks like the panic is coming out of:
https://github.com/weaveworks/eksctl/blob/aaa82936e8a1a015bcf1063739e37a2d6dff0a78/pkg/nodebootstrap/bottlerocket.go#L82
and somehow, one of the members here is nil and being de-referenced
Diving into that chunk, I wonder if somehow the Settings for the bottlerocket member is empty and not getting filled with any kind of default:
https://github.com/weaveworks/eksctl/blob/aaa82936e8a1a015bcf1063739e37a2d6dff0a78/pkg/apis/eksctl.io/v1alpha5/types.go#L1241-L1244
Hi @jpmcb. Thanks for opening this issue as-well as doing an initial investigation!
The problem is indeed that the default config for Bottlerocket is not being set. The cause for this is that when checking the AMI Family in this case, we're doing it case sensitive - here. Instead we should have first normalized the AMI Family field as we're doing e.g. here.
While the fix is being worked on, you can just use Bottlerocket instead of BOTTLEROCKET in your command. Alternatively, if you feel confident, feel free to open a PR at any time!