pulumi-eks icon indicating copy to clipboard operation
pulumi-eks copied to clipboard

Allow ignoring changes to `desiredSize` of Node Groups for Cluster Autoscaler support

Open JustASquid opened this issue 1 year ago • 4 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

When using Cluster Autoscaler for automatically scaling node groups based on cluster requirements pulumi permanently shows a diff.

The problem is because the cluster autoscaler takes control of the desiredSize of the scalingConfig, putting it out of sync with Pulumi state. In pulumi, the recommended way to handle a case like this is to have Pulumi give up control over the specified property with the ignoreChanges option.

However, currently in Pulumi, ignoreChanges does nothing when given to a ComponentResource. See docs.

My suggestion for a simple and easy fix would be to pass ignoreChanges passed to the resource down to the options of the internally created aws.eks.NodeGroup or ASG when using the NodeGroup/NodeGroupV2 component.

JustASquid avatar Aug 09 '24 02:08 JustASquid

Hey @JustASquid, this sounds like a good enhancement to the node groups! I can see us adding a new parameter (e.g. ignoreDesiredSize) to the scalingConfig.

In the meantime you can achieve this using transforms as a workaround. For example using typescript:

const mng = new eks.ManagedNodeGroup("example-ng", {
    cluster: cluster,
    nodeGroupName: "aws-managed-ng",
    nodeRoleArn: role.arn,
    scalingConfig: {
        desiredSize: 4,
        maxSize: 10,
        minSize: 1,
    }
}, { transforms: [args => {
    if (args.type === "aws:eks/nodeGroup:NodeGroup") {
        return {
            props: args.props,
            opts: pulumi.mergeOptions(args.opts, { ignoreChanges: ["scalingConfig.desiredSize"] })
        }
    }
    return undefined;
}]});

flostadler avatar Aug 09 '24 08:08 flostadler

@JustASquid I slightly changed the title and description to capture more details. Let me know if I missed something!

flostadler avatar Aug 09 '24 13:08 flostadler

With https://github.com/pulumi/pulumi/issues/12154 feature we could one day direct the user to transforms or emit warnings on unused ignoreChanges accordingly.

t0yv0 avatar Aug 14 '24 16:08 t0yv0

This is done now and will be released as part of EKS v3

flostadler avatar Sep 26 '24 23:09 flostadler