Skip to content

Commit 1db5097

Browse files
authored
feat: add event for prefiltered instance types (#1891)
1 parent b3fa6eb commit 1db5097

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

pkg/controllers/provisioning/scheduling/events.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ func NominatePodEvent(pod *corev1.Pod, node *corev1.Node, nodeClaim *v1.NodeClai
4949
}
5050
}
5151

52+
func NoCompatibleInstanceTypes(np *v1.NodePool) events.Event {
53+
return events.Event{
54+
InvolvedObject: np,
55+
Type: corev1.EventTypeWarning,
56+
Reason: "NoCompatibleInstanceTypes",
57+
Message: "NodePool requirements filtered out all compatible available instance types",
58+
DedupeValues: []string{string(np.UID)},
59+
DedupeTimeout: 1 * time.Minute,
60+
}
61+
}
62+
5263
func PodFailedToScheduleEvent(pod *corev1.Pod, err error) events.Event {
5364
return events.Event{
5465
InvolvedObject: pod,

pkg/controllers/provisioning/scheduling/scheduler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func NewScheduler(ctx context.Context, kubeClient client.Client, nodePools []*v1
6464
nct := NewNodeClaimTemplate(np)
6565
nct.InstanceTypeOptions = filterInstanceTypesByRequirements(instanceTypes[np.Name], nct.Requirements, corev1.ResourceList{}).remaining
6666
if len(nct.InstanceTypeOptions) == 0 {
67+
recorder.Publish(NoCompatibleInstanceTypes(np))
6768
log.FromContext(ctx).WithValues("NodePool", klog.KRef("", np.Name)).Info("skipping, nodepool requirements filtered out all instance types")
6869
return nil, false
6970
}

pkg/controllers/state/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ var _ = Describe("Consolidated State", func() {
14801480
fakeClock.Step(time.Minute)
14811481
Expect(cluster.ConsolidationState()).To(Equal(state))
14821482

1483-
fakeClock.Step(time.Minute * 3)
1483+
fakeClock.Step(time.Minute * 2)
14841484
Expect(cluster.ConsolidationState()).To(Equal(state))
14851485

14861486
fakeClock.Step(time.Minute * 2)

0 commit comments

Comments
 (0)