Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update karpenter_scheduler_unschedulable_pods_count #2006

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pkg/controllers/provisioning/scheduling/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,6 @@ func (s *Scheduler) Solve(ctx context.Context, pods []*corev1.Pod) Results {
// had 5xA pods and 5xB pods were they have a zonal topology spread, but A can only go in one zone and B in another.
// We need to schedule them alternating, A, B, A, B, .... and this solution also solves that as well.
errors := map[*corev1.Pod]error{}
// Reset the metric for the controller, so we don't keep old ids around
UnschedulablePodsCount.DeletePartialMatch(map[string]string{ControllerLabel: injection.GetControllerName(ctx)})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to drop the controller label when this metric is set too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one more thing that I think is missing here that I also called out in #2049 -- we need some way to set the value back to 0 when we happen not to hit the scheduling loop anymore because there were no pending pods (because pods were deleted) or the scheduler wasn't triggered

QueueDepth.DeletePartialMatch(map[string]string{ControllerLabel: injection.GetControllerName(ctx)})
for _, p := range pods {
s.updateCachedPodData(p)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/provisioning/scheduling/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3717,7 +3717,7 @@ var _ = Context("Scheduling", func() {
ExpectApplied(ctx, env.Client, i)
}
_, err := prov.Schedule(injection.WithControllerName(ctx, "provisioner"))
m, ok := FindMetricWithLabelValues("karpenter_scheduler_unschedulable_pods_count", map[string]string{"controller": "provisioner"})
m, ok := FindMetricWithLabelValues("karpenter_scheduler_unschedulable_pods_count", map[string]string{})
Expect(ok).To(BeTrue())
Expect(lo.FromPtr(m.Gauge.Value)).To(BeNumerically("==", 10))
Expect(err).To(BeNil())
Expand Down
Loading