From 887654160f9e5a0abfadc20b9eefe96a8203407b Mon Sep 17 00:00:00 2001 From: mantuliu <240951888@qq.com> Date: Thu, 4 May 2023 18:09:49 +0800 Subject: [PATCH] Improve the performance of schedulinggates --- .../framework/plugins/schedulinggates/scheduling_gates.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/scheduler/framework/plugins/schedulinggates/scheduling_gates.go b/pkg/scheduler/framework/plugins/schedulinggates/scheduling_gates.go index 249e31a3b57..e3e8a068570 100644 --- a/pkg/scheduler/framework/plugins/schedulinggates/scheduling_gates.go +++ b/pkg/scheduler/framework/plugins/schedulinggates/scheduling_gates.go @@ -46,7 +46,7 @@ func (pl *SchedulingGates) PreEnqueue(ctx context.Context, p *v1.Pod) *framework if !pl.enablePodSchedulingReadiness || len(p.Spec.SchedulingGates) == 0 { return nil } - var gates []string + gates := make([]string, 0, len(p.Spec.SchedulingGates)) for _, gate := range p.Spec.SchedulingGates { gates = append(gates, gate.Name) }