mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-18 18:28:18 -05:00
Merge pull request #135955 from utam0k/async-metrics
scheduler: align the meaning of victim metrics between async preemption and sync preemption
This commit is contained in:
commit
b54554b72d
1 changed files with 4 additions and 4 deletions
|
|
@ -462,6 +462,8 @@ func (ev *Evaluator) SelectCandidate(ctx context.Context, candidates []Candidate
|
|||
// - Reject the victim pods if they are in waitingPod map
|
||||
// - Clear the low-priority pods' nominatedNodeName status if needed
|
||||
func (ev *Evaluator) prepareCandidate(ctx context.Context, c Candidate, pod *v1.Pod, pluginName string) *fwk.Status {
|
||||
metrics.PreemptionVictims.Observe(float64(len(c.Victims().Pods)))
|
||||
|
||||
fh := ev.Handler
|
||||
cs := ev.Handler.ClientSet()
|
||||
|
||||
|
|
@ -484,8 +486,6 @@ func (ev *Evaluator) prepareCandidate(ctx context.Context, c Candidate, pod *v1.
|
|||
return fwk.AsStatus(err)
|
||||
}
|
||||
|
||||
metrics.PreemptionVictims.Observe(float64(len(c.Victims().Pods)))
|
||||
|
||||
// Lower priority pods nominated to run on this node, may no longer fit on
|
||||
// this node. So, we should remove their nomination. Removing their
|
||||
// nomination updates these pods and moves them to the active queue. It
|
||||
|
|
@ -532,8 +532,6 @@ func clearNominatedNodeName(ctx context.Context, cs clientset.Interface, apiCach
|
|||
//
|
||||
// See http://kep.k8s.io/4832 for how the async preemption works.
|
||||
func (ev *Evaluator) prepareCandidateAsync(c Candidate, pod *v1.Pod, pluginName string) {
|
||||
metrics.PreemptionVictims.Observe(float64(len(c.Victims().Pods)))
|
||||
|
||||
// Intentionally create a new context, not using a ctx from the scheduling cycle, to create ctx,
|
||||
// because this process could continue even after this scheduling cycle finishes.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
|
@ -553,6 +551,8 @@ func (ev *Evaluator) prepareCandidateAsync(c Candidate, pod *v1.Pod, pluginName
|
|||
return
|
||||
}
|
||||
|
||||
metrics.PreemptionVictims.Observe(float64(len(c.Victims().Pods)))
|
||||
|
||||
errCh := parallelize.NewErrorChannel()
|
||||
preemptPod := func(index int) {
|
||||
victim := victimPods[index]
|
||||
|
|
|
|||
Loading…
Reference in a new issue