Skip to content

🐛 fix(addons): avoid infinite reconciliation loop #5458

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/cloud/services/eks/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (s *Service) translateAPIToAddon(addons []ekscontrolplanev1.Addon) []*eksad
convertedAddon := &eksaddons.EKSAddon{
Name: &addon.Name,
Version: &addon.Version,
Configuration: &addon.Configuration,
Configuration: convertConfiguration(addon.Configuration),
Tags: ngTags(s.scope.Cluster.Name, s.scope.AdditionalTags()),
ResolveConflict: convertConflictResolution(*addon.ConflictResolution),
ServiceAccountRoleARN: addon.ServiceAccountRoleArn,
Expand All @@ -215,3 +215,10 @@ func convertConflictResolution(conflict ekscontrolplanev1.AddonResolution) *stri
}
return aws.String(eks.ResolveConflictsOverwrite)
}

func convertConfiguration(configuration string) *string {
if configuration == "" {
return nil
}
return &configuration
}
5 changes: 1 addition & 4 deletions pkg/eks/addons/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type EKSAddon struct {

// IsEqual determines if 2 EKSAddon are equal.
func (e *EKSAddon) IsEqual(other *EKSAddon, includeTags bool) bool {
//NOTE: we do not compare the ARN as that is only for existing addons
// NOTE: we do not compare the ARN as that is only for existing addons
if e == other {
return true
}
Expand All @@ -49,9 +49,6 @@ func (e *EKSAddon) IsEqual(other *EKSAddon, includeTags bool) bool {
if !cmp.Equal(e.Configuration, other.Configuration) {
return false
}
if !cmp.Equal(e.ResolveConflict, other.ResolveConflict) {
return false
}

if includeTags {
diffTags := e.Tags.Difference(other.Tags)
Expand Down
26 changes: 26 additions & 0 deletions pkg/eks/addons/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,32 @@ func TestAddOnEqual(t *testing.T) {
},
result: gomega.BeTrueBecause("addon values are equal (except status)"),
},
{
orig: &EKSAddon{
Version: ptr("a"),
ServiceAccountRoleARN: ptr("b"),
Configuration: nil,
},
other: &EKSAddon{
Version: ptr("a"),
ServiceAccountRoleARN: ptr("b"),
Configuration: nil,
},
result: gomega.BeTrueBecause("addon values are equal with optional nil configuration"),
},
{
orig: &EKSAddon{
Version: ptr("a"),
ServiceAccountRoleARN: ptr("b"),
ResolveConflict: ptr("OVERWRITE"),
},
other: &EKSAddon{
Version: ptr("a"),
ServiceAccountRoleARN: ptr("b"),
ResolveConflict: nil,
},
result: gomega.BeTrueBecause("addon values are equal with expected diff on resolve conflict"),
},
{
orig: &EKSAddon{
Version: ptr("a"),
Expand Down
Loading