Skip to content
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

Managed node group ignores provided AMI id #1550

Closed
shashiranjan84 opened this issue Dec 23, 2024 · 2 comments · Fixed by #1562
Closed

Managed node group ignores provided AMI id #1550

shashiranjan84 opened this issue Dec 23, 2024 · 2 comments · Fixed by #1562
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@shashiranjan84
Copy link

shashiranjan84 commented Dec 23, 2024

What happened?

When I create a managed node group with a amiID, worker node instance do not have same amiID.

Example

const EKS_VERSION = '1.30';
const ami = pulumi.interpolate`/aws/service/eks/optimized-ami/${EKS_VERSION}/amazon-linux-2023/x86_64/nvidia/recommended/image_id`.apply((name) =>
      aws.ssm.getParameter({ name,  }, { async: true, provider: ... }),
    ).apply((result) => result.value);

const cluster = new eks.Cluster(
      `${regionalNamespace}-cluster`,
      {
        name: `${regionalNamespace}`,
        version: EKS_VERSION,
        vpcId: ...,
        privateSubnetIds: ...
        publicSubnetIds: ...,
        enabledClusterLogTypes: ['api', 'audit', 'authenticator'],
        tags: projectTags,
        endpointPrivateAccess: true,
        endpointPublicAccess: true,
        nodeAssociatePublicIpAddress: false,
        providerCredentialOpts: {
          profileName: aws.config.profile,
        },
        roleMappings: [
          ...
        ],
        instanceType: 'g5.2xlarge',
        // gpu: true,
       nodeAmiId: ami,
        nodeRootVolumeSize: 200,
        ...,
      },
      { provider: ... },
    );

    new eks.ManagedNodeGroup(
      `${regionalNamespace}-ng`,
      {
        cluster,
        amiId:  ami,
        gpu: true,
        instanceTypes: ['g5.xlarge'],
        ignoreScalingChanges: true,
        scalingConfig: {
          minSize: 1,
          maxSize: 2,
          desiredSize: DESIRED_RESOURCE_COUNT[config.env].node.desiredCapacity,
        },
        diskSize: 200,
        nodeRole: cluster.instanceRoles[0],
        enableIMDSv2: true,
        labels: {
          'transcend.io/k8s_version': '1.31'
        },
        tags: {
          ...projectTags,
          'k8s.io/cluster-autoscaler/enabled': 'true',
          [`k8s.io/cluster-autoscaler/${regionalNamespace}`]: 'owned',
        },
      },
      { provider: MAIN_REGION_PROVIDERS[mainRegion] },
    );

Output of pulumi about

CLI
Version 3.142.0
Go Version go1.23.3
Go Compiler gc

Host
OS debian
Version 11.7
Arch x86_64

Backend
Name fv-az1490-728
URL s3://staging-pulumi-state-io
User root
Organizations
Token type personal

Additional context

Even when I tried to hardcode amiID in managed node group, it was ignored.

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).

@shashiranjan84 shashiranjan84 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Dec 23, 2024
@flostadler
Copy link
Contributor

Sorry you're running into this @shashiranjan84. This is indeed a bug in pulumi-eks.
Right now the custom AMI gets only set if custom userdata is needed for the underlying Launch Template. A custom AMI is also a reason for including custom userdata, but that's missing right now.

imageId: userData
? args.amiId ?? getRecommendedAMI(args, core.cluster.version, parent)
: undefined,

As a workaround you could force custom userdata by setting the nodeadmExtraOptions property.
E.g. this Noop script that just prints hello world:

nodeadmExtraOptions: [
    {
        contentType: `text/x-shellscript; charset="us-ascii"`,
        content: `#!/bin/bash\necho "Hello, World!"`,
    },
]

@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #1562 and shipped in release v3.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants