diff --git a/pkg/scheduler/plugins/scarceresourceavoidance/scarce_resource_avoidance.go b/pkg/scheduler/plugins/scarceresourceavoidance/scarce_resource_avoidance.go index a457f3f01..487cd7221 100644 --- a/pkg/scheduler/plugins/scarceresourceavoidance/scarce_resource_avoidance.go +++ b/pkg/scheduler/plugins/scarceresourceavoidance/scarce_resource_avoidance.go @@ -80,16 +80,13 @@ func (s *Plugin) Score(ctx context.Context, state *framework.CycleState, p *v1.P } func intersection(slice1, slice2 []v1.ResourceName) []v1.ResourceName { - // 创建一个 map 来存储 slice2 中的元素 m := make(map[v1.ResourceName]struct{}) result := []v1.ResourceName{} - // 将 slice2 中的所有元素存入 map for _, v := range slice2 { m[v] = struct{}{} } - // 遍历 slice1,找出交集 for _, v := range slice1 { if _, found := m[v]; found { result = append(result, v) @@ -101,13 +98,11 @@ func intersection(slice1, slice2 []v1.ResourceName) []v1.ResourceName { func difference(slice1, slice2 []v1.ResourceName) []v1.ResourceName { var result []v1.ResourceName - // 将 slice2 中的元素存入 map m := make(map[v1.ResourceName]struct{}) for _, v := range slice2 { m[v] = struct{}{} } - // 遍历 slice1,保留在 slice2 中没有的元素 for _, v := range slice1 { if _, found := m[v]; !found { result = append(result, v) @@ -125,10 +120,6 @@ type preFilterState struct { framework.Resource } -func sub() { - -} - func computePodResourceRequest(pod *v1.Pod) *preFilterState { // pod hasn't scheduled yet so we don't need to worry about InPlacePodVerticalScalingEnabled reqs := resource.PodRequests(pod, resource.PodResourcesOptions{})