pulumi-eks
pulumi-eks copied to clipboard
Error in nodegroupv2 if you don't specify an AMI
What happened?
Have two separate projects, one with the EKS cluster in and one with v2 NodeGroup.
When running pulumi up against the second stack, I get the error:
error: Error: invocation of aws:ssm/getParameter:getParameter returned an error: invoking aws:ssm/getParameter:getParameter: 1 error occurred:
* Error describing SSM parameter (/aws/service/eks/optimized-ami/undefined/amazon-linux-2/recommended/image_id): ParameterNotFound:
(note the undefined in the SSM parameter path - it should be a version number)
Expected Behavior
The NodeGroup should be deployed.
Steps to reproduce
Code for the EKS cluster stack and the nodegroup stack: https://gist.github.com/pierskarsenbarg/94c004e7756b357f06584b02273bc54f
Output of pulumi about
CLI
Version 3.69.0
Go Version go1.20.4
Go Compiler gc
Plugins
NAME VERSION
aws 5.41.0
aws 5.10.0
awsx 1.0.2
docker 3.6.1
eks 0.42.7
kubernetes 3.20.2
nodejs unknown
Host
OS darwin
Version 13.4
Arch x86_64
Current Stack: pierskarsenbarg/node-stack/dev
Found no resources associated with dev
Found no pending operations associated with dev
Backend
Name pulumi.com
URL https://app.pulumi.com/pierskarsenbarg
User pierskarsenbarg
Organizations pierskarsenbarg, karsenbarg, team-ce, demo
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Note this also happens in v1 of the EKS SDK as well
Hi @pierskarsenbarg, reviewing the code I see that the missing version is supposed to come from one of two places: the NodeGroupV2's arguments (optional), or else the cluster version. Is this maybe the first time you're up-ing this stack, and there is no cluster yet?
As a workaround, you should be able to specify Version.
@thomas11 the cluster does exist. I believe the fact that it’s not picking up the version from the cluster to be because of #855
I see, @pierskarsenbarg. #855 looks like a plausible cause. Any luck specifying an explicit version as a workaround?
@thomas11 what's the input for that? version looks to be the kubernetes version. Do we then match that up with the corresponding AMI version?
@pierskarsenbarg reading the code, it seems that it is the k8s version that's used in the AMI URL. Unless I'm misunderstanding something - I'm not super familiar with EKS.
const version = pulumi.output(args.version || core.cluster.version);
// https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html
let amiId: pulumi.Input<string> | undefined = args.amiId;
if (!amiId) {
const amiType = args.amiType ?? args.gpu ? "amazon-linux-2-gpu" : "amazon-linux-2";
amiId = version.apply((v) => {
const parameterName = `/aws/service/eks/optimized-ami/${v}/${amiType}/recommended/image_id`;
// ^^^^
return pulumi.output(
aws.ssm.getParameter({ name: parameterName }, { parent, async: true }),
).value;
});
}
@thomas11 I don't believe it is the k8s version. Looking at the actual list in the AWS Console, the latest for the amazon-linux-v2 that are in existence are the following:
which was last modified a while ago.
Then there are the arm64 versions:
@pierskarsenbarg - there is a PR open to fix this here. Could someone from Pulumi take a look, please?