Skip to content

Commit c61fb8e

Browse files
Eytan AvisrorEytan Avisror
authored andcommitted
evaluate added tags
Signed-off-by: Eytan Avisror <[email protected]>
1 parent 6a04c23 commit c61fb8e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

controllers/provisioners/eks/scaling/launchconfig_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ func TestLaunchConfigurationDrifted(t *testing.T) {
480480
LaunchConfigurationName: aws.String("my-launch-config"),
481481
},
482482
input: &CreateConfigurationInput{
483-
SecurityGroups: []string{},
483+
SecurityGroups: []string{},
484484
MetadataOptions: &v1alpha1.MetadataOptions{HttpEndpoint: "enabled"},
485485
},
486486
shouldDrift: true,

controllers/provisioners/eks/update.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,11 @@ func (ctx *EksInstanceGroupContext) UpdateScalingGroup(configName string, scalin
235235

236236
func (ctx *EksInstanceGroupContext) TagsUpdateNeeded() bool {
237237
var (
238-
instanceGroup = ctx.GetInstanceGroup()
239-
configuration = instanceGroup.GetEKSConfiguration()
240-
state = ctx.GetDiscoveredState()
241-
scalingGroup = state.GetScalingGroup()
242-
asgName = aws.StringValue(scalingGroup.AutoScalingGroupName)
243-
rmTags = ctx.GetRemovedTags(asgName)
238+
state = ctx.GetDiscoveredState()
239+
scalingGroup = state.GetScalingGroup()
240+
asgName = aws.StringValue(scalingGroup.AutoScalingGroupName)
241+
rmTags = ctx.GetRemovedTags(asgName)
242+
addedTags = ctx.GetAddedTags(asgName)
244243
)
245244

246245
if len(rmTags) > 0 {
@@ -256,7 +255,11 @@ func (ctx *EksInstanceGroupContext) TagsUpdateNeeded() bool {
256255
existingTags = append(existingTags, tagSet)
257256
}
258257

259-
for _, tag := range configuration.GetTags() {
258+
for _, tag := range addedTags {
259+
tag := map[string]string{
260+
"key": aws.StringValue(tag.Key),
261+
"value": aws.StringValue(tag.Value),
262+
}
260263
if !common.StringMapSliceContains(existingTags, tag) {
261264
return true
262265
}

0 commit comments

Comments
 (0)