-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Cherry-pick release-1.12] Fix scheduler panic when metrics are disabled #4849
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
base: release-1.12
Are you sure you want to change the base?
Conversation
Move InitKubeSchedulerRelatedMetrics() outside conditional block to ensure k8smetrics.Goroutines is always initialized before scheduler starts. This is a manual cherry-pick of PR #4731 to the release-1.12 branch. Co-authored-by: JesseStutler <38534065+JesseStutler@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical scheduler panic that occurs when the scheduler is started without the --enable-metrics=true flag. The panic was caused by a nil pointer dereference in k8smetrics.Goroutines, which is accessed by Kubernetes scheduler framework plugins regardless of the metrics flag setting.
Key changes:
- Move metric registry initialization outside the conditional block to ensure it always occurs
- Add explanatory comment documenting why this initialization is required unconditionally
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/retest |
Cherry-pick of #4731 to release-1.12. Scheduler panics with nil pointer dereference when started without
--enable-metrics=truebecause Kubernetes scheduler framework plugins accessk8smetrics.Goroutinesunconditionally.Changes:
metrics.InitKubeSchedulerRelatedMetrics()outside the metrics-enabled conditional incmd/scheduler/app/server.go--enable-metricsflagThe panic occurs in
k8s.io/kubernetes/pkg/scheduler/framework/parallelize.Parallelizer.Untilwhen it callsGoroutines.WithLabelValues()on a nil metric.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.