mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
fix AWS tagging to add missing tags only
It seems that intention of original code was to build map of missing tags and call AWS API to add just them, but due to typo full set of tags was always (re)added
This commit is contained in:
parent
ef4b4acf1e
commit
54203aaa9e
@ -174,7 +174,7 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.createTags(client, resourceID, lifecycle, additionalTags); err != nil {
|
||||
if err := c.createTags(client, resourceID, lifecycle, addTags); err != nil {
|
||||
return fmt.Errorf("error adding missing tags to resource %q: %v", resourceID, err)
|
||||
}
|
||||
|
||||
@ -184,9 +184,7 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy
|
||||
// createTags calls EC2 CreateTags, but adds retry-on-failure logic
|
||||
// We retry mainly because if we create an object, we cannot tag it until it is "fully created" (eventual consistency)
|
||||
// The error code varies though (depending on what we are tagging), so we simply retry on all errors
|
||||
func (t *awsTagging) createTags(client EC2, resourceID string, lifecycle ResourceLifecycle, additionalTags map[string]string) error {
|
||||
tags := t.buildTags(lifecycle, additionalTags)
|
||||
|
||||
func (t *awsTagging) createTags(client EC2, resourceID string, lifecycle ResourceLifecycle, tags map[string]string) error {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user