-
Notifications
You must be signed in to change notification settings - Fork 295
Support EC2 instance tags per node role #1027
Support EC2 instance tags per node role #1027
Conversation
This feature will be handy when e.g. your monitoring tools discovers EC2 instances and then groups resource metrics with EC2 instance tags. Changes: - Add support for stackTags to SpotFleet-based node pool - Add a new configuration key `instanceTags` to cluster.yaml per `worker.nodePools[]`, `controller` and `etcd`. I recomment to use `stackTags` for adding cluster-wide metadata to all the resources managed by Cfn, whereas `instanceTags` are by definition used for node-group-wide metadata to EC2 instances(node pool name, node role, and anything configurable per node pool for example). A typical cluster.yaml using both `stackTags` and `instanceTags` would look like: ```yaml worker: nodePools: - name: pool1 instanceTags: myrole: worker type: ondemand # Propagated to (hopefully, it's up to cfn) all the stack resources for the pool1 stack stackTags: env: prod - name: pool2 spotFleet: targetCapacity: 2 # Propagated to EC2 instances managed by this spot fleet (via tag-spot-instance.service) instanceTags: myrole: worker type: spot # Propagated to (hopefully, it's up to cfn) all the stack resources for the pool2 stack stackTags: env: prod controller: instanceTags: myrole: controller type: ondemand # invalid as controller nodes don't have a dedicated cfn stack # stackTags: etcd: instanceTags: myrole: etcd type: ondemand # invalid as etcd nodes don't have a dedicated cfn stack # stackTags: stackTags: env: prod ``` Resolves kubernetes-retired#1026
Codecov Report
@@ Coverage Diff @@
## master #1027 +/- ##
=======================================
Coverage 34.91% 34.91%
=======================================
Files 59 59
Lines 4159 4159
=======================================
Hits 1452 1452
Misses 2545 2545
Partials 162 162
Continue to review full report at Codecov.
|
@mumoshu wow, this is great! Let's merge it asap. Maybe it's more than most people will need but the flexibility will be good. What's the use case for I was looking through the code to see why we hadn't added much about stack tags here and I found some |
@@ -397,7 +405,7 @@ worker: | |||
# # IAM role to grant the Spot fleet permission to bid on, launch, and terminate instances on your behalf | |||
# # See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html#spot-fleet-prerequisites | |||
# # | |||
# # Defaults to "arn:aws:iam::youraccountid:role/aws-ec2-spot-fleet-role" assuming you've arrived "Spot Requests" in EC2 Dashboard | |||
# # Defaults to "arn:aws:iam::youraccountid:role/aws-ec2-spot-fleet-tagging-role" assuming you've arrived "Spot Requests" in EC2 Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like part of #1024 slipped in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are correct. Sorry but I had no time to test this in isolation, as noted in Depends on #1024
in the PR description!
@c-knowles Thanks for reviewing!
Just wanted to sync up with you but have you verified this behavior? |
@mumoshu nope, I've not run that case. OK then, I expected it to work like that as we've described |
Perhaps we could simplify and remove |
@c-knowles Thx for the suggestion! |
@c-knowles I've opened #1038 for discussing that |
@mumoshu I've just been trying this, I could not get After updating an existing cluster, I also have a root stack has a tag that does not exist any more in the root |
…tags-per-role Support EC2 instance tags per node role
@c-knowles Would this be what you had needed?
This feature will be handy when e.g. your monitoring tools discovers EC2 instances and then groups resource metrics with EC2 instance tags.
Changes:
instanceTags
to cluster.yaml perworker.nodePools[]
,controller
andetcd
.I recomment to use
stackTags
for adding cluster-wide metadata to all the resources managed by Cfn, whereasinstanceTags
are by definition used for node-group-wide metadata to EC2 instances(node pool name, node role, and anything configurable per node pool for example).A typical cluster.yaml using both
stackTags
andinstanceTags
would look like:Resolves #1026
Depends on #1024 in order to test in combination with spot fleet support