diff --git a/pkg/cloud/services/eks/addons.go b/pkg/cloud/services/eks/addons.go index 45c9a8cd82..c1bc494d8a 100644 --- a/pkg/cloud/services/eks/addons.go +++ b/pkg/cloud/services/eks/addons.go @@ -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, @@ -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 +} diff --git a/pkg/eks/addons/types.go b/pkg/eks/addons/types.go index 67c4a2b58a..9ddce2c176 100644 --- a/pkg/eks/addons/types.go +++ b/pkg/eks/addons/types.go @@ -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 } @@ -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) diff --git a/pkg/eks/addons/types_test.go b/pkg/eks/addons/types_test.go index dd363254cb..a21d685384 100644 --- a/pkg/eks/addons/types_test.go +++ b/pkg/eks/addons/types_test.go @@ -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"),