mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
rename 'PreemptionByKubeScheduler' to 'PreemptionByScheduler'
This commit is contained in:
parent
91742e2393
commit
9b64025f36
@ -275,7 +275,7 @@ func podTerminatingByPreemption(p *v1.Pod, enablePodDisruptionConditions bool) b
|
|||||||
|
|
||||||
for _, condition := range p.Status.Conditions {
|
for _, condition := range p.Status.Conditions {
|
||||||
if condition.Type == v1.DisruptionTarget {
|
if condition.Type == v1.DisruptionTarget {
|
||||||
return condition.Status == v1.ConditionTrue && condition.Reason == v1.PodReasonPreemptionByKubeScheduler
|
return condition.Status == v1.ConditionTrue && condition.Reason == v1.PodReasonPreemptionByScheduler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -1445,7 +1445,7 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
|
|||||||
fts: feature.Features{EnablePodDisruptionConditions: true},
|
fts: feature.Features{EnablePodDisruptionConditions: true},
|
||||||
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
|
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
|
||||||
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().
|
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().
|
||||||
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByKubeScheduler).Obj()},
|
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByScheduler).Obj()},
|
||||||
nodes: []string{"node1"},
|
nodes: []string{"node1"},
|
||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
@ -1462,7 +1462,7 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
|
|||||||
fts: feature.Features{EnablePodDisruptionConditions: false},
|
fts: feature.Features{EnablePodDisruptionConditions: false},
|
||||||
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
|
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
|
||||||
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().
|
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().
|
||||||
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByKubeScheduler).Obj()},
|
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByScheduler).Obj()},
|
||||||
nodes: []string{"node1"},
|
nodes: []string{"node1"},
|
||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
|
@ -361,7 +361,7 @@ func (ev *Evaluator) prepareCandidate(ctx context.Context, c Candidate, pod *v1.
|
|||||||
victimPodApply.Status.WithConditions(corev1apply.PodCondition().
|
victimPodApply.Status.WithConditions(corev1apply.PodCondition().
|
||||||
WithType(v1.DisruptionTarget).
|
WithType(v1.DisruptionTarget).
|
||||||
WithStatus(v1.ConditionTrue).
|
WithStatus(v1.ConditionTrue).
|
||||||
WithReason(v1.PodReasonPreemptionByKubeScheduler).
|
WithReason(v1.PodReasonPreemptionByScheduler).
|
||||||
WithMessage(fmt.Sprintf("Kube-scheduler: preempting to accommodate a higher priority pod: %s", klog.KObj(pod))).
|
WithMessage(fmt.Sprintf("Kube-scheduler: preempting to accommodate a higher priority pod: %s", klog.KObj(pod))).
|
||||||
WithLastTransitionTime(metav1.Now()),
|
WithLastTransitionTime(metav1.Now()),
|
||||||
)
|
)
|
||||||
|
@ -2722,9 +2722,9 @@ const (
|
|||||||
// is initiated by kubelet
|
// is initiated by kubelet
|
||||||
PodReasonTerminationByKubelet = "TerminationByKubelet"
|
PodReasonTerminationByKubelet = "TerminationByKubelet"
|
||||||
|
|
||||||
// PodReasonPreemptionByKubeScheduler reason in DisruptionTarget pod condition indicates that the
|
// PodReasonPreemptionByScheduler reason in DisruptionTarget pod condition indicates that the
|
||||||
// disruption was initiated by scheduler's preemption.
|
// disruption was initiated by scheduler's preemption.
|
||||||
PodReasonPreemptionByKubeScheduler = "PreemptionByKubeScheduler"
|
PodReasonPreemptionByScheduler = "PreemptionByScheduler"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PodCondition contains details for the current condition of this pod.
|
// PodCondition contains details for the current condition of this pod.
|
||||||
|
Loading…
Reference in New Issue
Block a user