From 1826bef64edddf042d4797f7012a0359eced4d5e Mon Sep 17 00:00:00 2001 From: Jiawen Liu Date: Wed, 6 Nov 2024 16:06:12 +0800 Subject: [PATCH] refactor: standard name --- .../framework/plugins/interpodaffinity/interpodaffinity.go | 4 ++-- .../framework/plugins/podtopologyspread/podtopologyspread.go | 4 ++-- pkg/binder/utils/util.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/binder/framework/plugins/interpodaffinity/interpodaffinity.go b/pkg/binder/framework/plugins/interpodaffinity/interpodaffinity.go index 957c303e..4210bac5 100644 --- a/pkg/binder/framework/plugins/interpodaffinity/interpodaffinity.go +++ b/pkg/binder/framework/plugins/interpodaffinity/interpodaffinity.go @@ -101,12 +101,12 @@ func (pl *InterPodAffinity) updateStateByVictims(state *utils.PreFilterState, ha continue } - splitPlods, err := binderutils.SplitPods(victimsMap) + launcherToPods, err := binderutils.GroupPodsByLauncher(victimsMap) if err != nil { return err } - for podLanucher, pods := range splitPlods { + for podLanucher, pods := range launcherToPods { nodeLabels := nodeInfo.GetNodeLabels(podLanucher) for _, pod := range pods { podInfo := framework.NewPodInfo(pod) diff --git a/pkg/binder/framework/plugins/podtopologyspread/podtopologyspread.go b/pkg/binder/framework/plugins/podtopologyspread/podtopologyspread.go index e19faf3b..f56e1e0f 100644 --- a/pkg/binder/framework/plugins/podtopologyspread/podtopologyspread.go +++ b/pkg/binder/framework/plugins/podtopologyspread/podtopologyspread.go @@ -152,12 +152,12 @@ func (pl *PodTopologySpreadCheck) updateStateByVictims(state *utils.PreFilterSta continue } - podMap, err := binderutils.SplitPods(victimsMap) + launcherToPods, err := binderutils.GroupPodsByLauncher(victimsMap) if err != nil { return err } - for podLanucher, pods := range podMap { + for podLanucher, pods := range launcherToPods { nodeLabels := nodeInfo.GetNodeLabels(podLanucher) for _, constraint := range state.Constraints { pair := utils.TopologyPair{Key: constraint.TopologyKey, Value: nodeLabels[constraint.TopologyKey]} diff --git a/pkg/binder/utils/util.go b/pkg/binder/utils/util.go index fa488247..e969e05f 100644 --- a/pkg/binder/utils/util.go +++ b/pkg/binder/utils/util.go @@ -56,7 +56,7 @@ func CleanupPodAnnotations(client clientset.Interface, pod *v1.Pod) error { return nil } -func SplitPods(pods map[types.UID]*v1.Pod) (map[podutil.PodLauncher][]*v1.Pod, error) { +func GroupPodsByLauncher(pods map[types.UID]*v1.Pod) (map[podutil.PodLauncher][]*v1.Pod, error) { podMap := make(map[podutil.PodLauncher][]*v1.Pod) for _, pod := range pods {