From 9b64025f36630af9dae1600e231e6b429ae6bda6 Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Thu, 5 Jan 2023 10:31:48 -0800 Subject: [PATCH] rename 'PreemptionByKubeScheduler' to 'PreemptionByScheduler' --- .../framework/plugins/defaultpreemption/default_preemption.go | 2 +- .../plugins/defaultpreemption/default_preemption_test.go | 4 ++-- pkg/scheduler/framework/preemption/preemption.go | 2 +- staging/src/k8s.io/api/core/v1/types.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go index 20bef23a47e..711b54bf37d 100644 --- a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go +++ b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go @@ -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 diff --git a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption_test.go b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption_test.go index bc059a9b89a..97916380a62 100644 --- a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption_test.go +++ b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption_test.go @@ -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, }, diff --git a/pkg/scheduler/framework/preemption/preemption.go b/pkg/scheduler/framework/preemption/preemption.go index ee30605def2..58706af76d4 100644 --- a/pkg/scheduler/framework/preemption/preemption.go +++ b/pkg/scheduler/framework/preemption/preemption.go @@ -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()), ) diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index 46e2b6d12ea..341560b2c84 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -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.