Skip to content

Commit 5b2fce3

Browse files
committed
Don't require version to be set
Skip equal test if version is unset Skip empty conflict and Configurations Signed-off-by: Dinar Valeev <[email protected]>
1 parent a10fc5d commit 5b2fce3

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ spec:
120120
type: string
121121
required:
122122
- name
123-
- version
124123
type: object
125124
type: array
126125
associateOIDCProvider:

controlplane/eks/api/v1beta1/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ type Addon struct {
144144
// +kubebuilder:validation:Required
145145
Name string `json:"name"`
146146
// Version is the version of the addon to use
147+
// +optional
147148
Version string `json:"version"`
148149
// Configuration of the EKS addon
149150
// +optional

pkg/eks/addons/plan_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestEKSAddonPlan(t *testing.T) {
3535
addonARN := "aws://someaddonarn"
3636
addon1Name := "addon1"
3737
addon1version := "1.0.0"
38+
addon1versionNotSet := ""
3839
addon1Upgrade := "2.0.0"
3940
addonStatusActive := string(eks.AddonStatusActive)
4041
addonStatusUpdating := string(eks.AddonStatusUpdating)
@@ -179,6 +180,20 @@ func TestEKSAddonPlan(t *testing.T) {
179180
expectCreateError: false,
180181
expectDoError: false,
181182
},
183+
{
184+
name: "1 installed and 1 desired - both same and installed active",
185+
expect: func(m *mock_eksiface.MockEKSAPIMockRecorder) {
186+
// No Action expected
187+
},
188+
desiredAddons: []*EKSAddon{
189+
createDesiredAddon(addon1Name, addon1versionNotSet),
190+
},
191+
installedAddons: []*EKSAddon{
192+
createInstalledAddon(addon1Name, addon1version, addonARN, addonStatusActive),
193+
},
194+
expectCreateError: false,
195+
expectDoError: false,
196+
},
182197
{
183198
name: "1 installed and 1 desired - both same and installed is creating",
184199
expect: func(m *mock_eksiface.MockEKSAPIMockRecorder) {

pkg/eks/addons/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ func (e *EKSAddon) IsEqual(other *EKSAddon, includeTags bool) bool {
4040
if e == other {
4141
return true
4242
}
43-
if !cmp.Equal(e.Version, other.Version) {
43+
if !cmp.Equal(e.Version, other.Version) && *e.Version != "" {
4444
return false
4545
}
4646
if !cmp.Equal(e.ServiceAccountRoleARN, other.ServiceAccountRoleARN) {
4747
return false
4848
}
49-
if !cmp.Equal(e.Configuration, other.Configuration) {
49+
if !cmp.Equal(e.Configuration, other.Configuration) && other.Configuration != nil {
5050
return false
5151
}
52-
if !cmp.Equal(e.ResolveConflict, other.ResolveConflict) {
52+
if !cmp.Equal(e.ResolveConflict, other.ResolveConflict) && other.ResolveConflict != nil {
5353
return false
5454
}
5555

0 commit comments

Comments
 (0)