From edff1c3b2fd13a93cba792a1bb4cb1c5d3c7ba9a Mon Sep 17 00:00:00 2001 From: nayihz Date: Sat, 6 Jan 2024 19:00:36 +0800 Subject: [PATCH] swap originalPod and modifiedPod to match the comments. --- .../framework/plugins/podtopologyspread/plugin.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/scheduler/framework/plugins/podtopologyspread/plugin.go b/pkg/scheduler/framework/plugins/podtopologyspread/plugin.go index 29ad4187bb4..c96db37d025 100644 --- a/pkg/scheduler/framework/plugins/podtopologyspread/plugin.go +++ b/pkg/scheduler/framework/plugins/podtopologyspread/plugin.go @@ -196,25 +196,25 @@ func (pl *PodTopologySpread) isSchedulableAfterPodChange(logger klog.Logger, pod } // Pod is added. Return Queue when the added Pod has a label that matches with topologySpread's selector. - if originalPod != nil { - if podLabelsMatchSpreadConstraints(constraints, originalPod.Labels) { + if modifiedPod != nil { + if podLabelsMatchSpreadConstraints(constraints, modifiedPod.Labels) { logger.V(5).Info("a scheduled pod was created and it matches with the pod's topology spread constraints", - "pod", klog.KObj(pod), "createdPod", klog.KObj(originalPod)) + "pod", klog.KObj(pod), "createdPod", klog.KObj(modifiedPod)) return framework.Queue, nil } logger.V(5).Info("a scheduled pod was created, but it doesn't matches with the pod's topology spread constraints", - "pod", klog.KObj(pod), "createdPod", klog.KObj(originalPod)) + "pod", klog.KObj(pod), "createdPod", klog.KObj(modifiedPod)) return framework.QueueSkip, nil } // Pod is deleted. Return Queue when the deleted Pod has a label that matches with topologySpread's selector. - if podLabelsMatchSpreadConstraints(constraints, modifiedPod.Labels) { + if podLabelsMatchSpreadConstraints(constraints, originalPod.Labels) { logger.V(5).Info("a scheduled pod which matches with the pod's topology spread constraints was deleted, and the pod may be schedulable now", - "pod", klog.KObj(pod), "deletedPod", klog.KObj(modifiedPod)) + "pod", klog.KObj(pod), "deletedPod", klog.KObj(originalPod)) return framework.Queue, nil } logger.V(5).Info("a scheduled pod was deleted, but it's unrelated to the pod's topology spread constraints", - "pod", klog.KObj(pod), "deletedPod", klog.KObj(modifiedPod)) + "pod", klog.KObj(pod), "deletedPod", klog.KObj(originalPod)) return framework.QueueSkip, nil }