File tree 3 files changed +35
-6
lines changed
3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ func (s *Service) translateAPIToAddon(addons []ekscontrolplanev1.Addon) []*eksad
197
197
convertedAddon := & eksaddons.EKSAddon {
198
198
Name : & addon .Name ,
199
199
Version : & addon .Version ,
200
- Configuration : & addon .Configuration ,
200
+ Configuration : convertConfiguration ( addon .Configuration ) ,
201
201
Tags : ngTags (s .scope .Cluster .Name , s .scope .AdditionalTags ()),
202
202
ResolveConflict : convertConflictResolution (* addon .ConflictResolution ),
203
203
ServiceAccountRoleARN : addon .ServiceAccountRoleArn ,
@@ -215,3 +215,10 @@ func convertConflictResolution(conflict ekscontrolplanev1.AddonResolution) *stri
215
215
}
216
216
return aws .String (eks .ResolveConflictsOverwrite )
217
217
}
218
+
219
+ func convertConfiguration (configuration string ) * string {
220
+ if configuration == "" {
221
+ return nil
222
+ }
223
+ return & configuration
224
+ }
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ package addons
18
18
19
19
import (
20
20
"github.com/google/go-cmp/cmp"
21
-
22
21
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
23
22
)
24
23
@@ -36,7 +35,7 @@ type EKSAddon struct {
36
35
37
36
// IsEqual determines if 2 EKSAddon are equal.
38
37
func (e * EKSAddon ) IsEqual (other * EKSAddon , includeTags bool ) bool {
39
- //NOTE: we do not compare the ARN as that is only for existing addons
38
+ // NOTE: we do not compare the ARN as that is only for existing addons
40
39
if e == other {
41
40
return true
42
41
}
@@ -49,9 +48,6 @@ func (e *EKSAddon) IsEqual(other *EKSAddon, includeTags bool) bool {
49
48
if ! cmp .Equal (e .Configuration , other .Configuration ) {
50
49
return false
51
50
}
52
- if ! cmp .Equal (e .ResolveConflict , other .ResolveConflict ) {
53
- return false
54
- }
55
51
56
52
if includeTags {
57
53
diffTags := e .Tags .Difference (other .Tags )
Original file line number Diff line number Diff line change @@ -54,6 +54,32 @@ func TestAddOnEqual(t *testing.T) {
54
54
},
55
55
result : gomega .BeTrueBecause ("addon values are equal (except status)" ),
56
56
},
57
+ {
58
+ orig : & EKSAddon {
59
+ Version : ptr ("a" ),
60
+ ServiceAccountRoleARN : ptr ("b" ),
61
+ Configuration : nil ,
62
+ },
63
+ other : & EKSAddon {
64
+ Version : ptr ("a" ),
65
+ ServiceAccountRoleARN : ptr ("b" ),
66
+ Configuration : nil ,
67
+ },
68
+ result : gomega .BeTrueBecause ("addon values are equal with optional nil configuration" ),
69
+ },
70
+ {
71
+ orig : & EKSAddon {
72
+ Version : ptr ("a" ),
73
+ ServiceAccountRoleARN : ptr ("b" ),
74
+ ResolveConflict : ptr ("OVERWRITE" ),
75
+ },
76
+ other : & EKSAddon {
77
+ Version : ptr ("a" ),
78
+ ServiceAccountRoleARN : ptr ("b" ),
79
+ ResolveConflict : nil ,
80
+ },
81
+ result : gomega .BeTrueBecause ("addon values are equal with expected diff on resolve conflict" ),
82
+ },
57
83
{
58
84
orig : & EKSAddon {
59
85
Version : ptr ("a" ),
You can’t perform that action at this time.
0 commit comments