Merge pull request #122622 from nayihz/cleanup_comment

swap originalPod and modifiedPod to match the comments
This commit is contained in:
Kubernetes Prow Robot 2024-01-06 14:20:50 +01:00 committed by GitHub
commit b529e6ff1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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. // Pod is added. Return Queue when the added Pod has a label that matches with topologySpread's selector.
if originalPod != nil { if modifiedPod != nil {
if podLabelsMatchSpreadConstraints(constraints, originalPod.Labels) { if podLabelsMatchSpreadConstraints(constraints, modifiedPod.Labels) {
logger.V(5).Info("a scheduled pod was created and it matches with the pod's topology spread constraints", 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 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", 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 return framework.QueueSkip, nil
} }
// Pod is deleted. Return Queue when the deleted Pod has a label that matches with topologySpread's selector. // 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", 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 return framework.Queue, nil
} }
logger.V(5).Info("a scheduled pod was deleted, but it's unrelated to the pod's topology spread constraints", 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 return framework.QueueSkip, nil
} }