mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Merge pull request #122622 from nayihz/cleanup_comment
swap originalPod and modifiedPod to match the comments
This commit is contained in:
commit
b529e6ff1c
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user