Skip to content

Commit 4c3ca02

Browse files
Don't wait for metrics-server if its the only add-on (#8552)
1 parent 3445930 commit 4c3ca02

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

pkg/actions/addon/addon_helper.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,17 @@ func (a *Helper) ValidateNodeGroupCreation(ctx context.Context) error {
3737
}
3838
return nil
3939
}
40+
41+
func ShouldWaitForAddons(nodes bool, addons []*api.Addon) bool {
42+
addonsRequireWait := false
43+
for _, a := range addons {
44+
addonInfo, ok := api.KnownAddons[a.Name]
45+
// Assume unknown add-ons need to wait.
46+
if !ok || !addonInfo.DontRequireWait {
47+
addonsRequireWait = true
48+
break
49+
}
50+
}
51+
52+
return nodes && addonsRequireWait
53+
}

pkg/actions/addon/addon_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,32 @@ var _ = Describe("Addon", func() {
1717
})
1818
})
1919
})
20+
21+
var _ = Describe("ShouldWaitForAddons", func() {
22+
It("returns false when nodes is false", func() {
23+
addons := []*api.Addon{{Name: api.VPCCNIAddon}}
24+
Expect(addon.ShouldWaitForAddons(false, addons)).To(BeFalse())
25+
})
26+
27+
It("returns false when no addons", func() {
28+
Expect(addon.ShouldWaitForAddons(true, nil)).To(BeFalse())
29+
})
30+
31+
It("returns false for metrics-server", func() {
32+
addons := []*api.Addon{{Name: api.MetricsServerAddon}}
33+
Expect(addon.ShouldWaitForAddons(true, addons)).To(BeFalse())
34+
})
35+
36+
It("returns true for unknown addons", func() {
37+
addons := []*api.Addon{{Name: "unknown-addon"}}
38+
Expect(addon.ShouldWaitForAddons(true, addons)).To(BeTrue())
39+
})
40+
41+
It("returns true when any addon requires wait", func() {
42+
addons := []*api.Addon{
43+
{Name: api.MetricsServerAddon},
44+
{Name: "unknown-addon"},
45+
}
46+
Expect(addon.ShouldWaitForAddons(true, addons)).To(BeTrue())
47+
})
48+
})

pkg/actions/addon/tasks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func CreateAddonTasks(ctx context.Context, cfg *api.ClusterConfig, clusterProvid
8282
preTasks.Append(makeAddonTask(preAddons, false))
8383
}
8484
if len(postAddons) > 0 {
85-
postTasks.Append(makeAddonTask(postAddons, cfg.HasNodes()))
85+
postTasks.Append(makeAddonTask(postAddons, ShouldWaitForAddons(cfg.HasNodes(), postAddons)))
8686
}
8787
var updateVPCCNI *tasks.GenericTask
8888
if vpcCNIAddon != nil && api.IsEnabled(cfg.IAM.WithOIDC) {

pkg/apis/eksctl.io/v1alpha5/known_addons.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var KnownAddons = map[string]struct {
66
IsDefault bool
77
CreateBeforeNodeGroup bool
88
IsDefaultAutoMode bool
9+
DontRequireWait bool
910
ExcludedRegions []string
1011
}{
1112
VPCCNIAddon: {
@@ -41,6 +42,10 @@ var KnownAddons = map[string]struct {
4142
RegionUSISOFSouth1,
4243
RegionEUISOEWest1,
4344
},
45+
// Don't require waiting for metrics-server to be up if it's the only add-on to wait for.
46+
// This is because this add-on is installed by default and we don't
47+
// want to make a large change blocking cluster creating on this add-on coming up successfully in setups.
48+
DontRequireWait: true,
4449
},
4550
}
4651

0 commit comments

Comments
 (0)