Skip to content

Commit

Permalink
refactor: delete the handle parameter in updateStateByVictims function
Browse files Browse the repository at this point in the history
  • Loading branch information
slipegg committed Nov 6, 2024
1 parent 1826bef commit 034b107
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (pl *InterPodAffinity) CheckTopology(_ context.Context, cycleState *framewo
return framework.NewStatus(framework.Error, err.Error())
}
if commonState != nil {
pl.updateStateByVictims(state, pl.frameworkHandle, commonState.VictimsGroupByNode, pod)
pl.updateStateByVictims(state, commonState.VictimsGroupByNode, pod)
}

if !utils.SatisfyPodAffinity(state, nodeInfo, podLauncher) {
Expand All @@ -94,9 +94,9 @@ func New(_ runtime.Object, handle handle.BinderFrameworkHandle) (framework.Plugi
}, nil
}

func (pl *InterPodAffinity) updateStateByVictims(state *utils.PreFilterState, handle handle.BinderFrameworkHandle, victimsGroupByNode map[string]map[types.UID]*v1.Pod, targetPod *v1.Pod) error {
func (pl *InterPodAffinity) updateStateByVictims(state *utils.PreFilterState, victimsGroupByNode map[string]map[types.UID]*v1.Pod, targetPod *v1.Pod) error {
for nodeName, victimsMap := range victimsGroupByNode {
nodeInfo := handle.GetNodeInfo(nodeName)
nodeInfo := pl.frameworkHandle.GetNodeInfo(nodeName)
if nodeInfo == nil {
continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (pl *PodTopologySpreadCheck) CheckTopology(_ context.Context, cycleState *f
return framework.NewStatus(framework.Error, err.Error())
}
if commonState != nil {
pl.updateStateByVictims(&state, pl.frameworkHandle, commonState.VictimsGroupByNode)
pl.updateStateByVictims(&state, commonState.VictimsGroupByNode)
}

return utils.IsSatisfyPodTopologySpreadConstraints(&state, pod, nodeInfo, podLauncher)
Expand Down Expand Up @@ -145,9 +145,9 @@ func (pl *PodTopologySpreadCheck) getConstraints(pod *v1.Pod) ([]utils.TopologyS
return constraints, nil
}

func (pl *PodTopologySpreadCheck) updateStateByVictims(state *utils.PreFilterState, handle handle.BinderFrameworkHandle, victimsGroupByNode map[string]map[types.UID]*v1.Pod) error {
func (pl *PodTopologySpreadCheck) updateStateByVictims(state *utils.PreFilterState, victimsGroupByNode map[string]map[types.UID]*v1.Pod) error {
for nodeName, victimsMap := range victimsGroupByNode {
nodeInfo := handle.GetNodeInfo(nodeName)
nodeInfo := pl.frameworkHandle.GetNodeInfo(nodeName)
if nodeInfo == nil {
continue
}
Expand Down

0 comments on commit 034b107

Please sign in to comment.