https://pulumi.com logo
#general
Title
# general
s

some-continent-1577

03/01/2022, 12:33 PM
Hello, is it possible to modify the ASG tags of an EKS cluster? I’ve tried a few things but am worried that I’ll have to recreate the entire nodegroups for this
I’m using python and creating a pulumi_eks.Cluster then a few pulumi_eks.ManagedNodeGroups. I first tried passing node_group_options=pulumi_eks.ClusterNodeGroupOptionsArgs(auto_scaling_group_tags=tags) to the Cluster constructor, but got:
Copy code
Exception: Setting nodeGroupOptions, and any set of singular node group option(s) on the cluster, is mutually exclusive. Choose a single approach.
then I tried modifying the cluster object returned by the Cluster constructor with
cluster.core.node_group_options.auto_scaling_group_tags = subnet_tags
then passing cluster=cluster.core to the ManagedNodeGroup constructor, and that didn’t raise an error but the change in tags wasn’t detected.
Still haven’t figured out how to do this 😕
g

great-queen-39697

03/01/2022, 4:28 PM
Just so I'm sure I get you the right info, which package are you using? I'm guessing it's https://www.pulumi.com/registry/packages/eks/api-docs/cluster/, but I want to be sure you're not using the classic/native AWS provider before I give you the wrong info.
s

some-continent-1577

03/01/2022, 4:29 PM
Hi Laura, yes, I’m using the packing you linked (specifically pulumi-eks==0.37.1 on pypi)
I’ve been looking into this, and I’m thinking it actually may not be possible to specify autoscaling group tags at all to an eks.ManagedNodeGroup - could this be a gap in the python client? Really I’ll be happy if you can tell me how to do that; whether or not I need to recreate the nodegroup
g

great-queen-39697

03/01/2022, 4:50 PM
Got it. Let me dig in; hold tight
Ok, so it looks like there's a gap in general (not just for Python) for the ManagedNodeGroup resource for autoscaling tags: https://github.com/pulumi/pulumi-eks/issues/658 As you noted with your attempt to modify the cluster object, I suspect that the tags are actually stored in https://www.pulumi.com/registry/packages/eks/api-docs/managednodegroup/#cloud_formation_tags_python based on a dive into the resource schema that led to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html. So I think you're headed in the right direction. I'd probably try something like this directly by adding the tags in the Cluster definition (note that I haven't tried this yet):
Copy code
my_cluster = eks.Cluster(
    #...
    node_group_options=eks.ClusterNodeGroupOptionsArgs(
        auto_scaling_group_tags =[ 'str', 'str' ]
    )
)
my_node_group = eks.ManagedNodeGroup(
    "managed-group",
    # ...
    cluster=eks.CoreDataArgs(
        cluster = my_cluster
    )
)
If it's not working even then, I'd open an issue against the repo, unfortunately, as I'm guessing it's a bug.
31 Views