From 410b6023d6f038cba27885b1abd72ba26af1b921 Mon Sep 17 00:00:00 2001 From: SataQiu Date: Mon, 5 Jun 2023 17:29:49 +0800 Subject: [PATCH] scheduler: fix code style issues for pkg/scheduler --- .../apis/config/validation/validation_pluginargs.go | 2 +- .../framework/plugins/volumebinding/assume_cache.go | 2 +- pkg/scheduler/framework/runtime/framework.go | 2 +- pkg/scheduler/scheduler.go | 6 +++--- pkg/scheduler/testing/wrappers.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/scheduler/apis/config/validation/validation_pluginargs.go b/pkg/scheduler/apis/config/validation/validation_pluginargs.go index cf946933b45..15c9ddfaa31 100644 --- a/pkg/scheduler/apis/config/validation/validation_pluginargs.go +++ b/pkg/scheduler/apis/config/validation/validation_pluginargs.go @@ -271,7 +271,7 @@ func ValidateVolumeBindingArgs(path *field.Path, args *config.VolumeBindingArgs) }) } -// ValidateVolumeBindingArgs validates that VolumeBindingArgs with scheduler features. +// ValidateVolumeBindingArgsWithOptions validates that VolumeBindingArgs and VolumeBindingArgsValidationOptions with scheduler features. func ValidateVolumeBindingArgsWithOptions(path *field.Path, args *config.VolumeBindingArgs, opts VolumeBindingArgsValidationOptions) error { var allErrs field.ErrorList diff --git a/pkg/scheduler/framework/plugins/volumebinding/assume_cache.go b/pkg/scheduler/framework/plugins/volumebinding/assume_cache.go index 283b4083e69..5b512776221 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/assume_cache.go +++ b/pkg/scheduler/framework/plugins/volumebinding/assume_cache.go @@ -43,7 +43,7 @@ type AssumeCache interface { // Get the object by name Get(objName string) (interface{}, error) - // Get the API object by name + // GetAPIObj gets the API object by name GetAPIObj(objName string) (interface{}, error) // List all the objects in the cache diff --git a/pkg/scheduler/framework/runtime/framework.go b/pkg/scheduler/framework/runtime/framework.go index 4380a404ef1..780e0a7923e 100644 --- a/pkg/scheduler/framework/runtime/framework.go +++ b/pkg/scheduler/framework/runtime/framework.go @@ -602,7 +602,7 @@ func updatePluginList(pluginList interface{}, pluginSet config.PluginSet, plugin return nil } -// EnqueuePlugins returns the registered enqueue plugins. +// PreEnqueuePlugins returns the registered preEnqueue plugins. func (f *frameworkImpl) PreEnqueuePlugins() []framework.PreEnqueuePlugin { return f.preEnqueuePlugins } diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index 910f4091cde..406f2d96553 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -103,9 +103,9 @@ type Scheduler struct { logger klog.Logger } -func (s *Scheduler) applyDefaultHandlers() { - s.SchedulePod = s.schedulePod - s.FailureHandler = s.handleSchedulingFailure +func (sched *Scheduler) applyDefaultHandlers() { + sched.SchedulePod = sched.schedulePod + sched.FailureHandler = sched.handleSchedulingFailure } type schedulerOptions struct { diff --git a/pkg/scheduler/testing/wrappers.go b/pkg/scheduler/testing/wrappers.go index 218e551adb0..bb0dc78f131 100644 --- a/pkg/scheduler/testing/wrappers.go +++ b/pkg/scheduler/testing/wrappers.go @@ -930,12 +930,12 @@ type PodSchedulingWrapper struct { resourcev1alpha2.PodSchedulingContext } -// MakePodSchedulingContext creates a PodSchedulingContext wrapper. +// MakePodSchedulingContexts creates a PodSchedulingContext wrapper. func MakePodSchedulingContexts() *PodSchedulingWrapper { return &PodSchedulingWrapper{resourcev1alpha2.PodSchedulingContext{}} } -// FromPodSchedulingContext creates a PodSchedulingContext wrapper from some existing object. +// FromPodSchedulingContexts creates a PodSchedulingContext wrapper from an existing object. func FromPodSchedulingContexts(other *resourcev1alpha2.PodSchedulingContext) *PodSchedulingWrapper { return &PodSchedulingWrapper{*other.DeepCopy()} }