Hello, is it possible to modify the ASG tags of an...
# general
s
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
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
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
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.
c
I think I've now run into this as well.... I'm using a
ManagedNodeGroup
, with
ManagedNodeGroupArgs
, specifying a
scaling_config
.... I've tried several things so far and I can't seem to tag the actual AWS AutoScaling Group itself. My instances are tagged, my LT is tagged - everything is tagged but I can't figure out the tagging of the ASG....
I found this: https://www.pulumi.com/blog/automatically-enforcing-aws-resource-tagging-policies/#automatically-applying-tags ... which is actually quite helpful but at this point I was hoping to target the ASGs seeing how this appears to be the only thing missing
I think I've now run into this as well.... I'm using a
ManagedNodeGroup
, with
ManagedNodeGroupArgs
, specifying a
scaling_config
.... I've tried several things so far and I can't seem to tag the actual AWS AutoScaling Group itself. My instances are tagged, my LT is tagged - everything is tagged but I can't figure out the tagging of the ASG....
via the python SDK (latest version), adding
auto_scaling_group_tags
to the
ManagedNodeGroup
doesn't seem to do anything, though, adding
auto_scaling_group_tags
to the
ManagedNodeGroupArgs
bombs with
Copy code
TypeError: ManagedNodeGroupArgs.__init__() got an unexpected keyword argument 'auto_scaling_group_tags'
so, is the ManagedNodeGroup just ignoring them ?