Migrate pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go to use contextual logging

This commit is contained in:
Mengjiao Liu 2023-04-04 18:56:19 +08:00
parent eeb1399383
commit 37a9260d5c

View File

@ -142,6 +142,7 @@ func (pl *DefaultPreemption) SelectVictimsOnNode(
pod *v1.Pod,
nodeInfo *framework.NodeInfo,
pdbs []*policy.PodDisruptionBudget) ([]*v1.Pod, int, *framework.Status) {
logger := klog.FromContext(ctx)
var potentialVictims []*framework.PodInfo
removePod := func(rpi *framework.PodInfo) error {
if err := nodeInfo.RemovePod(rpi.Pod); err != nil {
@ -207,7 +208,7 @@ func (pl *DefaultPreemption) SelectVictimsOnNode(
}
rpi := pi.Pod
victims = append(victims, rpi)
klog.V(5).InfoS("Pod is a potential preemption victim on node", "pod", klog.KObj(rpi), "node", klog.KObj(nodeInfo.Node()))
logger.V(5).Info("Pod is a potential preemption victim on node", "pod", klog.KObj(rpi), "node", klog.KObj(nodeInfo.Node()))
}
return fits, nil
}