Skip to content

Commit 6a20100

Browse files
committed
Improve events when max total nodes of the cluster is reached.
- log cluster wide event - previous event would never get fired because the estimators would already cap the options they generate and additionally it would fire once and events are kept only for some time - log per pod event explaining why the scale up is not triggered (previously it would either get no scale up because no matching group or it would not get an event at all)
1 parent 03e2795 commit 6a20100

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: cluster-autoscaler/core/static_autoscaler.go

+6
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,12 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
535535
} else if a.MaxNodesTotal > 0 && len(readyNodes) >= a.MaxNodesTotal {
536536
scaleUpStatus.Result = status.ScaleUpNoOptionsAvailable
537537
klog.V(1).Infof("Max total nodes in cluster reached: %v. Current number of ready nodes: %v", a.MaxNodesTotal, len(readyNodes))
538+
autoscalingContext.LogRecorder.Eventf(apiv1.EventTypeWarning, "MaxNodesTotalReached",
539+
"Max total nodes in cluster reached: %v", autoscalingContext.MaxNodesTotal)
540+
for _, pod := range unschedulablePodsToHelp {
541+
autoscalingContext.Recorder.Event(pod, apiv1.EventTypeNormal, "NotTriggerScaleUp",
542+
fmt.Sprintf("pod didn't trigger scale-up: %s", "max total nodes in cluster reached"))
543+
}
538544
} else if !isSchedulerProcessingIgnored && allPodsAreNew(unschedulablePodsToHelp, currentTime) {
539545
// The assumption here is that these pods have been created very recently and probably there
540546
// is more pods to come. In theory we could check the newest pod time but then if pod were created

0 commit comments

Comments
 (0)