diff --git a/pkg/scheduler/algorithm/predicates/metadata_test.go b/pkg/scheduler/algorithm/predicates/metadata_test.go index 7604efab659..8b0c061e5bf 100644 --- a/pkg/scheduler/algorithm/predicates/metadata_test.go +++ b/pkg/scheduler/algorithm/predicates/metadata_test.go @@ -39,7 +39,7 @@ func (s sortablePods) Less(i, j int) bool { func (s sortablePods) Len() int { return len(s) } func (s sortablePods) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -var _ = sort.Interface(&sortablePods{}) +var _ sort.Interface = &sortablePods{} // sortableServices allows us to sort services. type sortableServices []*v1.Service @@ -51,7 +51,7 @@ func (s sortableServices) Less(i, j int) bool { func (s sortableServices) Len() int { return len(s) } func (s sortableServices) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -var _ = sort.Interface(&sortableServices{}) +var _ sort.Interface = &sortableServices{} // predicateMetadataEquivalent returns true if the two metadata are equivalent. // Note: this function does not compare podRequest. diff --git a/pkg/scheduler/framework/plugins/examples/multipoint/multipoint.go b/pkg/scheduler/framework/plugins/examples/multipoint/multipoint.go index 52132a47564..2dcce2a515c 100644 --- a/pkg/scheduler/framework/plugins/examples/multipoint/multipoint.go +++ b/pkg/scheduler/framework/plugins/examples/multipoint/multipoint.go @@ -28,8 +28,8 @@ import ( // extension points. It communicates through state with another function. type CommunicatingPlugin struct{} -var _ = framework.ReservePlugin(CommunicatingPlugin{}) -var _ = framework.PreBindPlugin(CommunicatingPlugin{}) +var _ framework.ReservePlugin = CommunicatingPlugin{} +var _ framework.PreBindPlugin = CommunicatingPlugin{} // Name is the name of the plug used in Registry and configurations. const Name = "multipoint-communicating-plugin" diff --git a/pkg/scheduler/framework/plugins/examples/prebind/prebind.go b/pkg/scheduler/framework/plugins/examples/prebind/prebind.go index 8ee7ca92c6c..12ba02485d4 100644 --- a/pkg/scheduler/framework/plugins/examples/prebind/prebind.go +++ b/pkg/scheduler/framework/plugins/examples/prebind/prebind.go @@ -29,7 +29,7 @@ import ( // and implements only one hook for prebind. type StatelessPreBindExample struct{} -var _ = framework.PreBindPlugin(StatelessPreBindExample{}) +var _ framework.PreBindPlugin = StatelessPreBindExample{} // Name is the name of the plugin used in Registry and configurations. const Name = "stateless-prebind-plugin-example" diff --git a/pkg/scheduler/framework/plugins/examples/stateful/stateful.go b/pkg/scheduler/framework/plugins/examples/stateful/stateful.go index 0bdd502cd4b..ceece62a1d0 100644 --- a/pkg/scheduler/framework/plugins/examples/stateful/stateful.go +++ b/pkg/scheduler/framework/plugins/examples/stateful/stateful.go @@ -36,8 +36,8 @@ type MultipointExample struct { mu sync.RWMutex } -var _ = framework.ReservePlugin(&MultipointExample{}) -var _ = framework.PreBindPlugin(&MultipointExample{}) +var _ framework.ReservePlugin = &MultipointExample{} +var _ framework.PreBindPlugin = &MultipointExample{} // Name is the name of the plug used in Registry and configurations. const Name = "multipoint-plugin-example" diff --git a/pkg/scheduler/framework/plugins/imagelocality/image_locality.go b/pkg/scheduler/framework/plugins/imagelocality/image_locality.go index dde6c8c7542..7f90a79e39a 100644 --- a/pkg/scheduler/framework/plugins/imagelocality/image_locality.go +++ b/pkg/scheduler/framework/plugins/imagelocality/image_locality.go @@ -29,12 +29,12 @@ import ( var mb int64 = 1024 * 1024 -// ImageLocality is a plugin that checks if a pod tolerates a node's taints. +// ImageLocality is a score plugin that favors nodes that already have requested pod container's images. type ImageLocality struct { handle framework.FrameworkHandle } -var _ = framework.ScorePlugin(&ImageLocality{}) +var _ framework.ScorePlugin = &ImageLocality{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "ImageLocality" diff --git a/pkg/scheduler/framework/plugins/nodename/node_name.go b/pkg/scheduler/framework/plugins/nodename/node_name.go index 31715671b68..90a3d84d5c6 100644 --- a/pkg/scheduler/framework/plugins/nodename/node_name.go +++ b/pkg/scheduler/framework/plugins/nodename/node_name.go @@ -30,7 +30,7 @@ import ( // NodeName is a plugin that checks if a pod spec node name matches the current node. type NodeName struct{} -var _ = framework.FilterPlugin(&NodeName{}) +var _ framework.FilterPlugin = &NodeName{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "NodeName" diff --git a/pkg/scheduler/framework/plugins/nodename/node_name_test.go b/pkg/scheduler/framework/plugins/nodename/node_name_test.go index bfd2b9711d8..e046a797b02 100644 --- a/pkg/scheduler/framework/plugins/nodename/node_name_test.go +++ b/pkg/scheduler/framework/plugins/nodename/node_name_test.go @@ -32,14 +32,12 @@ func TestNodeName(t *testing.T) { tests := []struct { pod *v1.Pod node *v1.Node - fits bool name string wantStatus *framework.Status }{ { pod: &v1.Pod{}, node: &v1.Node{}, - fits: true, name: "no host specified", }, { @@ -53,7 +51,6 @@ func TestNodeName(t *testing.T) { Name: "foo", }, }, - fits: true, name: "host matches", }, { @@ -67,7 +64,6 @@ func TestNodeName(t *testing.T) { Name: "foo", }, }, - fits: false, name: "host doesn't match", wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, predicates.ErrPodNotMatchHostName.GetReason()), }, diff --git a/pkg/scheduler/framework/plugins/nodeports/node_ports.go b/pkg/scheduler/framework/plugins/nodeports/node_ports.go index d41a050bd8d..f97a2508c15 100644 --- a/pkg/scheduler/framework/plugins/nodeports/node_ports.go +++ b/pkg/scheduler/framework/plugins/nodeports/node_ports.go @@ -30,7 +30,7 @@ import ( // NodePorts is a plugin that checks if a node has free ports for the requested pod ports. type NodePorts struct{} -var _ = framework.FilterPlugin(&NodePorts{}) +var _ framework.FilterPlugin = &NodePorts{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "NodePorts" diff --git a/pkg/scheduler/framework/plugins/noderesources/node_resources.go b/pkg/scheduler/framework/plugins/noderesources/node_resources.go index 7cf39a4c7cc..3bb96d3a2e1 100644 --- a/pkg/scheduler/framework/plugins/noderesources/node_resources.go +++ b/pkg/scheduler/framework/plugins/noderesources/node_resources.go @@ -31,7 +31,7 @@ import ( // NodeResources is a plugin that checks if a node has sufficient resources. type NodeResources struct{} -var _ = framework.FilterPlugin(&NodeResources{}) +var _ framework.FilterPlugin = &NodeResources{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "NodeResources" diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/node_volume_limits.go b/pkg/scheduler/framework/plugins/nodevolumelimits/node_volume_limits.go index 461ba03cf7d..37181c404b6 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/node_volume_limits.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/node_volume_limits.go @@ -19,7 +19,7 @@ package nodevolumelimits import ( "context" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/kubernetes/pkg/scheduler/algorithm/predicates" "k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration" framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1" @@ -31,7 +31,7 @@ type NodeVolumeLimits struct { predicate predicates.FitPredicate } -var _ = framework.FilterPlugin(&NodeVolumeLimits{}) +var _ framework.FilterPlugin = &NodeVolumeLimits{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "NodeVolumeLimits" diff --git a/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go b/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go index 99616a61cf7..569980edfad 100644 --- a/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go +++ b/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go @@ -34,8 +34,8 @@ type TaintToleration struct { handle framework.FrameworkHandle } -var _ = framework.FilterPlugin(&TaintToleration{}) -var _ = framework.ScorePlugin(&TaintToleration{}) +var _ framework.FilterPlugin = &TaintToleration{} +var _ framework.ScorePlugin = &TaintToleration{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "TaintToleration" diff --git a/pkg/scheduler/framework/plugins/volumerestrictions/volume_restrictions.go b/pkg/scheduler/framework/plugins/volumerestrictions/volume_restrictions.go index 642c45af19f..a4dea04d57f 100644 --- a/pkg/scheduler/framework/plugins/volumerestrictions/volume_restrictions.go +++ b/pkg/scheduler/framework/plugins/volumerestrictions/volume_restrictions.go @@ -27,10 +27,10 @@ import ( "k8s.io/kubernetes/pkg/scheduler/nodeinfo" ) -// VolumeRestrictions is a plugin that checks volume restrictions +// VolumeRestrictions is a plugin that checks volume restrictions. type VolumeRestrictions struct{} -var _ = framework.FilterPlugin(&VolumeRestrictions{}) +var _ framework.FilterPlugin = &VolumeRestrictions{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "VolumeRestrictions" diff --git a/pkg/scheduler/framework/plugins/volumezone/volume_zone.go b/pkg/scheduler/framework/plugins/volumezone/volume_zone.go index e7ed01de27a..22b511bd641 100644 --- a/pkg/scheduler/framework/plugins/volumezone/volume_zone.go +++ b/pkg/scheduler/framework/plugins/volumezone/volume_zone.go @@ -26,12 +26,12 @@ import ( "k8s.io/kubernetes/pkg/scheduler/nodeinfo" ) -// VolumeZone is a plugin that checks volume zone +// VolumeZone is a plugin that checks volume zone. type VolumeZone struct { predicate predicates.FitPredicate } -var _ = framework.FilterPlugin(&VolumeZone{}) +var _ framework.FilterPlugin = &VolumeZone{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "VolumeZone" diff --git a/pkg/scheduler/framework/v1alpha1/framework.go b/pkg/scheduler/framework/v1alpha1/framework.go index 4dd78d9788b..8bab08576e0 100644 --- a/pkg/scheduler/framework/v1alpha1/framework.go +++ b/pkg/scheduler/framework/v1alpha1/framework.go @@ -127,7 +127,7 @@ func WithInformerFactory(informerFactory informers.SharedInformerFactory) Option var defaultFrameworkOptions = frameworkOptions{} -var _ = Framework(&framework{}) +var _ Framework = &framework{} // NewFramework initializes plugins given the configuration and the registry. func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfig, opts ...Option) (Framework, error) { diff --git a/pkg/scheduler/framework/v1alpha1/framework_test.go b/pkg/scheduler/framework/v1alpha1/framework_test.go index 496b0d17035..089fe328b07 100644 --- a/pkg/scheduler/framework/v1alpha1/framework_test.go +++ b/pkg/scheduler/framework/v1alpha1/framework_test.go @@ -47,8 +47,8 @@ const ( // TestScoreWithNormalizePlugin implements ScoreWithNormalizePlugin interface. // TestScorePlugin only implements ScorePlugin interface. -var _ = ScorePlugin(&TestScoreWithNormalizePlugin{}) -var _ = ScorePlugin(&TestScorePlugin{}) +var _ ScorePlugin = &TestScoreWithNormalizePlugin{} +var _ ScorePlugin = &TestScorePlugin{} func newScoreWithNormalizePlugin1(injArgs *runtime.Unknown, f FrameworkHandle) (Plugin, error) { var inj injectedResult diff --git a/pkg/scheduler/internal/queue/scheduling_queue.go b/pkg/scheduler/internal/queue/scheduling_queue.go index 6b3146c11ba..74e25c1b0cd 100644 --- a/pkg/scheduler/internal/queue/scheduling_queue.go +++ b/pkg/scheduler/internal/queue/scheduling_queue.go @@ -187,7 +187,7 @@ var defaultPriorityQueueOptions = priorityQueueOptions{ } // Making sure that PriorityQueue implements SchedulingQueue. -var _ = SchedulingQueue(&PriorityQueue{}) +var _ SchedulingQueue = &PriorityQueue{} // newPodInfoNoTimestamp builds a PodInfo object without timestamp. func newPodInfoNoTimestamp(pod *v1.Pod) *framework.PodInfo { diff --git a/test/integration/scheduler/framework_test.go b/test/integration/scheduler/framework_test.go index 94b4f08a2b0..86e090e95d5 100644 --- a/test/integration/scheduler/framework_test.go +++ b/test/integration/scheduler/framework_test.go @@ -116,18 +116,18 @@ const ( permitPluginName = "permit-plugin" ) -var _ = framework.PreFilterPlugin(&PreFilterPlugin{}) -var _ = framework.ScorePlugin(&ScorePlugin{}) -var _ = framework.FilterPlugin(&FilterPlugin{}) -var _ = framework.ScorePlugin(&ScorePlugin{}) -var _ = framework.ScorePlugin(&ScoreWithNormalizePlugin{}) -var _ = framework.ReservePlugin(&ReservePlugin{}) -var _ = framework.PostFilterPlugin(&PostFilterPlugin{}) -var _ = framework.PreBindPlugin(&PreBindPlugin{}) -var _ = framework.BindPlugin(&BindPlugin{}) -var _ = framework.PostBindPlugin(&PostBindPlugin{}) -var _ = framework.UnreservePlugin(&UnreservePlugin{}) -var _ = framework.PermitPlugin(&PermitPlugin{}) +var _ framework.PreFilterPlugin = &PreFilterPlugin{} +var _ framework.ScorePlugin = &ScorePlugin{} +var _ framework.FilterPlugin = &FilterPlugin{} +var _ framework.ScorePlugin = &ScorePlugin{} +var _ framework.ScorePlugin = &ScoreWithNormalizePlugin{} +var _ framework.ReservePlugin = &ReservePlugin{} +var _ framework.PostFilterPlugin = &PostFilterPlugin{} +var _ framework.PreBindPlugin = &PreBindPlugin{} +var _ framework.BindPlugin = &BindPlugin{} +var _ framework.PostBindPlugin = &PostBindPlugin{} +var _ framework.UnreservePlugin = &UnreservePlugin{} +var _ framework.PermitPlugin = &PermitPlugin{} // newPlugin returns a plugin factory with specified Plugin. func newPlugin(plugin framework.Plugin) framework.PluginFactory { diff --git a/test/integration/scheduler/preemption_test.go b/test/integration/scheduler/preemption_test.go index cc7483e2168..677f7e3350f 100644 --- a/test/integration/scheduler/preemption_test.go +++ b/test/integration/scheduler/preemption_test.go @@ -118,7 +118,7 @@ func (fp *tokenFilter) PreFilterExtensions() framework.PreFilterExtensions { return fp } -var _ = framework.FilterPlugin(&tokenFilter{}) +var _ framework.FilterPlugin = &tokenFilter{} // TestPreemption tests a few preemption scenarios. func TestPreemption(t *testing.T) {