-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Add "owned" tag for volumes and instances created with launch templates #8660
Conversation
/cc @rifelpet |
Perhaps you meant that it checks if the resource is "shared" or "owned"? |
Yes. Updated. Thanks. |
@@ -101,6 +101,8 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde | |||
if err != nil { | |||
return nil, fmt.Errorf("error building cloud tags: %v", err) | |||
} | |||
// TODO: move this to CloudTagsForInstanceGroup when LaunchConfigurations are removed | |||
tags["kubernetes.io/cluster/"+b.ClusterName()] = "owned" |
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.
Perhaps call b.CloudTags("", false)
?
What would be the downside to moving that to CloudTagsFroInstanceGroup before LaunchConfigurations are removed? Why don't instances/volumes created by LaunchConfigurations throw the warning?
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.
What would be the downside to moving that to CloudTagsFroInstanceGroup before LaunchConfigurations are removed?
I don't know if it would affect any current workflow if this tag is applied at ASG level. Launch templates are still experimental in Kops and shouldn't be an issue.
Why don't instances/volumes created by LaunchConfigurations throw the warning?
Instances created with launch configurations don't tag root volumes at all. Because of this, the volumes are not tracked as part of the cluster by the delete function. They are still deleted automatically when the instance is deleted.
May also be a possibility to not track root volumes at all with the deleted function, even if they have the other tags.
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.
I like the idea of being consistent in what tags we apply.
I could see the KubernetesCluster
tag being useful for cost control and leaving it out lacks consistency, so I think we should call CloudTags
rather than setting kubernetes.io/cluster/
directly.
For consistency, I'm in favor of moving things into CloudTagsForInstanceGroup
sooner. Perhaps we should have CloudTagsForInstanceGroup
call CloudTags
. I don't know what the consequence of adding the ownership tags to the CloudTags
template function would be, though.
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.
I actually tried this as the first iteration, but the changes in tests were bigger than I expected.
I don't think should affect any workflow, but preferred not to change so much.
135bdb2
to
83c660b
Compare
83c660b
to
661bd6d
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hakman, rifelpet The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Using launch templates for instance groups make adds the kops & k8s tags to instances and root volumes.
For volumes, the cluster delete function checks if the resource is "shared" or "owned", otherwise it displays the following warning:
kops/pkg/resources/aws/aws.go
Lines 2134 to 2136 in 632b426