-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Tags are not propagated from EKS managed node group to auto-scaling groups #1886
Comments
Oups... it may be a duplicate of #860 |
The EKS managed node group service manages the autoscaling group created. You can use https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group_tag to tag the autoscaling groups after they are created |
Thanks for the pointer @bryantbiggs! I'm now able to add tags to created ASG using locals {
staging-asg-name = module.eks.eks_managed_node_groups["staging"].node_group_resources[0].autoscaling_groups[0].name
staging-asg-tags = [
{
tagKey = "k8s.io/cluster-autoscaler/node-template/label/env"
tagValue = "staging"
},
]
}
resource "aws_autoscaling_group_tag" "staging" {
for_each = { for k, v in local.staging-asg-tags : k => v }
autoscaling_group_name = local.staging-asg-name
tag {
key = each.value.tagKey
value = each.value.tagValue
propagate_at_launch = false
}
} I'm sure there is a way to loop over EKS managed node groups, find their ASG and replicate tag from node groups to ASG, |
@cthiebault - I had the same problem and a similar workaround. It would be nice if the module provided a way to handle ASG specific tags. I used an double loop (we use a locals to define worker groups, and inside it we define a field locals {
self_managed_node_groups = {
foo-worker-group = {
name = foo
instance_type = "m5.large"
min_size = 2
desired_size = 2
max_size = 5
....
// the `asg_tags` field is not recognised by the module.self_managed_node_groups, but we use it in the loop below
asg_tags = {
mytag1 = "aaa"
mytag2 = "bbb"
}
...
}
}
asg_tags = flatten([
for i in local.self_managed_node_groups : [
for k, v in i.asg_tags : {
id = join("-", [i.name, k])
name = i.name
key = k
value = v
}
]
])
}
}
resource "aws_autoscaling_group_tag" "this" {
for_each = { for t in local.asg_tags : t.id => t }
autoscaling_group_name = module.eks.self_managed_node_groups[each.value.name].autoscaling_group_name
tag {
key = each.value.key
value = each.value.value
propagate_at_launch = true
}
|
its not possible for it to exist natively within this module due to lifecycle constraints #1558 (comment) |
closing for now - see links/references shared for context |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
We are using cluster-autoscaler.
It needs tags on ASG to know which ASG to use to start or stop a new node.
We tags EKS Managed Node Groups but not all tags are propagated to ASG :-(
Versions
Terraform v1.1.5
on linux_amd64
Reproduction
Here are the tags for
test
EKS managed node group:Name=test
kubernetes.io/cluster/my-cluster=owned
k8s.io/cluster-autoscaler/enabled=true
k8s.io/cluster-autoscaler/my-cluster=true
k8s.io/cluster-autoscaler/node-template/label/env=test
And the tags for ASG created by
test
EKS managed node group:eks:cluster-name=my-cluster
eks:nodegroup-name=test-20220216130904674900000025
k8s.io/cluster-autoscaler/enabled=true
k8s.io/cluster-autoscaler/my-cluster=owned
kubernetes.io/cluster/my-cluster
Tag
k8s.io/cluster-autoscaler/node-template/label/env=test
specified in EKS managed node group is not propagated to ASG :-(Cluster autoscaler needs this tags
k8s.io/cluster-autoscaler/node-template/...
to find which ASG to use.Any ideas?
The text was updated successfully, but these errors were encountered: