pulumi / pulumi-eks

A Pulumi component for easily creating and managing an Amazon EKS Cluster
https://www.pulumi.com/registry/packages/eks/
Apache License 2.0
171 stars 80 forks source link

Ability to Ignore Changes on `desiredSize` in eks.ManagedNodeGroup #985

Open zbuchheit opened 10 months ago

zbuchheit commented 10 months ago

Hello!

Issue details

Context

Currently, any change to the desiredSize of a node group leads to updates within the EKS ManagedNodeGroup and the child NodeGroup, which can be disruptive and undesired in certain scenarios. For example, when scaling operations are managed by external tools or autoscaling policies, the Pulumi should not interfere with these dynamic changes.

Affected area/feature

eks.ManagedNodeGroup in AWS EKS

Expected Behavior

Introduce a configuration option, possibly a boolean flag, that allows the desiredSize of a node group to be ignored during updates. This would ensure that changes to this specific property do not trigger updates in the EKS ManagedNodeGroup, providing greater flexibility in managing node group sizes.

Impact

This feature would greatly enhance the usability of eks.ManagedNodeGroup for scenarios involving dynamic scaling, making it more adaptable to various operational requirements.

jerguslejko commented 8 months ago

Experiencing the same issue. I tried two other things:

  1. using transformations on eks.ManagedNodeGroup. however, the call is not executed for child resources (so aws:eks/nodeGroup:NodeGroup), just for the top level ones. I think this is hinting to another issue
  2. using pulumi.runtime.register_stack_transformation. this callback executes for aws:eks/nodeGroup:NodeGroup, but adding pulumi.ResourceOptions(ignore_changes=["scalingConfig.desiredSize"]) has no effect. I think actually no resources in this repository support ignore_changes as per this comment
flostadler commented 2 weeks ago

Ignoring changes to the desired size can now be done using the tansforms resource option. 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;
}]});

We've also started addressing this as part of the next major version (v3) of the provider.