Skip to content
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

Automated cherry pick of #8462: Tag EBS volumes when using launch templates with AWS API #8466: Update tags support for LaunchTemplates #8805

Conversation

hakman
Copy link
Member

@hakman hakman commented Mar 27, 2020

Cherry pick of #8462 #8466 on release-1.17.

#8462: Tag EBS volumes when using launch templates with AWS API
#8466: Update tags support for LaunchTemplates

For details on the cherry pick process, see the cherry pick requests page.

@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Mar 27, 2020
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 27, 2020
@rifelpet
Copy link
Member

Just to be clear and since we dont have tests that cover these, can you list out the tags that this will add and for which resources exactly?

@hakman
Copy link
Member Author

hakman commented Mar 27, 2020

@rifelpet This would add all InstanceGroup tags except for "owned", but only for the direct target (not touching TF and CF)

@hakman
Copy link
Member Author

hakman commented Mar 27, 2020

This is the function that creates the tags:

kops/pkg/model/context.go

Lines 184 to 232 in 7492c10

// CloudTagsForInstanceGroup computes the tags to apply to instances in the specified InstanceGroup
func (m *KopsModelContext) CloudTagsForInstanceGroup(ig *kops.InstanceGroup) (map[string]string, error) {
labels := make(map[string]string)
// Apply any user-specified global labels first so they can be overridden by IG-specific labels
for k, v := range m.Cluster.Spec.CloudLabels {
labels[k] = v
}
// Apply any user-specified labels
for k, v := range ig.Spec.CloudLabels {
labels[k] = v
}
// Apply labels for cluster autoscaler node labels
for k, v := range ig.Spec.NodeLabels {
labels[clusterAutoscalerNodeTemplateLabel+k] = v
}
// Apply labels for cluster autoscaler node taints
for _, v := range ig.Spec.Taints {
splits := strings.SplitN(v, "=", 2)
if len(splits) > 1 {
labels[clusterAutoscalerNodeTemplateTaint+splits[0]] = splits[1]
}
}
// Add cluster and ig names
labels[awsup.TagClusterName] = m.ClusterName()
labels["Name"] = m.AutoscalingGroupName(ig)
// The system tags take priority because the cluster likely breaks without them...
if ig.Spec.Role == kops.InstanceGroupRoleMaster {
labels[awstasks.CloudTagInstanceGroupRolePrefix+strings.ToLower(string(kops.InstanceGroupRoleMaster))] = "1"
}
if ig.Spec.Role == kops.InstanceGroupRoleNode {
labels[awstasks.CloudTagInstanceGroupRolePrefix+strings.ToLower(string(kops.InstanceGroupRoleNode))] = "1"
}
if ig.Spec.Role == kops.InstanceGroupRoleBastion {
labels[awstasks.CloudTagInstanceGroupRolePrefix+strings.ToLower(string(kops.InstanceGroupRoleBastion))] = "1"
}
labels[nodeidentityaws.CloudTagInstanceGroupName] = ig.Name
return labels, nil
}

@rifelpet
Copy link
Member

ok great, yea that makes sense to me and this seems pretty safe.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 27, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 27, 2020
@hakman
Copy link
Member Author

hakman commented Mar 27, 2020

Thanks @rifelpet

@k8s-ci-robot k8s-ci-robot merged commit 336e22c into kubernetes:release-1.17 Mar 27, 2020
@hakman hakman deleted the automated-cherry-pick-of-#8462-#8466-upstream-release-1.17 branch June 2, 2020 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants