rename 'PreemptionByKubeScheduler' to 'PreemptionByScheduler'

This commit is contained in:
Wei Huang 2023-01-05 10:31:48 -08:00
parent 91742e2393
commit 9b64025f36
No known key found for this signature in database
GPG Key ID: 17AFE05D01EA77B2
4 changed files with 6 additions and 6 deletions

View File

@ -275,7 +275,7 @@ func podTerminatingByPreemption(p *v1.Pod, enablePodDisruptionConditions bool) b
for _, condition := range p.Status.Conditions {
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

View File

@ -1445,7 +1445,7 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
fts: feature.Features{EnablePodDisruptionConditions: true},
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().
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByKubeScheduler).Obj()},
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByScheduler).Obj()},
nodes: []string{"node1"},
expected: false,
},
@ -1462,7 +1462,7 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
fts: feature.Features{EnablePodDisruptionConditions: false},
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().
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByKubeScheduler).Obj()},
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByScheduler).Obj()},
nodes: []string{"node1"},
expected: false,
},

View File

@ -361,7 +361,7 @@ func (ev *Evaluator) prepareCandidate(ctx context.Context, c Candidate, pod *v1.
victimPodApply.Status.WithConditions(corev1apply.PodCondition().
WithType(v1.DisruptionTarget).
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))).
WithLastTransitionTime(metav1.Now()),
)

View File

@ -2722,9 +2722,9 @@ const (
// is initiated by kubelet
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.
PodReasonPreemptionByKubeScheduler = "PreemptionByKubeScheduler"
PodReasonPreemptionByScheduler = "PreemptionByScheduler"
)
// PodCondition contains details for the current condition of this pod.