Skip to content

Commit 4222561

Browse files
authored
Merge pull request kubernetes#84073 from draveness/feature/cleanup-framework-plugins
feat: several cleanups in the scheduling package
2 parents b574074 + 39af760 commit 4222561

File tree

18 files changed

+37
-41
lines changed

18 files changed

+37
-41
lines changed

pkg/scheduler/algorithm/predicates/metadata_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (s sortablePods) Less(i, j int) bool {
3939
func (s sortablePods) Len() int { return len(s) }
4040
func (s sortablePods) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
4141

42-
var _ = sort.Interface(&sortablePods{})
42+
var _ sort.Interface = &sortablePods{}
4343

4444
// sortableServices allows us to sort services.
4545
type sortableServices []*v1.Service
@@ -51,7 +51,7 @@ func (s sortableServices) Less(i, j int) bool {
5151
func (s sortableServices) Len() int { return len(s) }
5252
func (s sortableServices) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
5353

54-
var _ = sort.Interface(&sortableServices{})
54+
var _ sort.Interface = &sortableServices{}
5555

5656
// predicateMetadataEquivalent returns true if the two metadata are equivalent.
5757
// Note: this function does not compare podRequest.

pkg/scheduler/framework/plugins/examples/multipoint/multipoint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import (
2828
// extension points. It communicates through state with another function.
2929
type CommunicatingPlugin struct{}
3030

31-
var _ = framework.ReservePlugin(CommunicatingPlugin{})
32-
var _ = framework.PreBindPlugin(CommunicatingPlugin{})
31+
var _ framework.ReservePlugin = CommunicatingPlugin{}
32+
var _ framework.PreBindPlugin = CommunicatingPlugin{}
3333

3434
// Name is the name of the plug used in Registry and configurations.
3535
const Name = "multipoint-communicating-plugin"

pkg/scheduler/framework/plugins/examples/prebind/prebind.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
// and implements only one hook for prebind.
3030
type StatelessPreBindExample struct{}
3131

32-
var _ = framework.PreBindPlugin(StatelessPreBindExample{})
32+
var _ framework.PreBindPlugin = StatelessPreBindExample{}
3333

3434
// Name is the name of the plugin used in Registry and configurations.
3535
const Name = "stateless-prebind-plugin-example"

pkg/scheduler/framework/plugins/examples/stateful/stateful.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ type MultipointExample struct {
3636
mu sync.RWMutex
3737
}
3838

39-
var _ = framework.ReservePlugin(&MultipointExample{})
40-
var _ = framework.PreBindPlugin(&MultipointExample{})
39+
var _ framework.ReservePlugin = &MultipointExample{}
40+
var _ framework.PreBindPlugin = &MultipointExample{}
4141

4242
// Name is the name of the plug used in Registry and configurations.
4343
const Name = "multipoint-plugin-example"

pkg/scheduler/framework/plugins/imagelocality/image_locality.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import (
2929

3030
var mb int64 = 1024 * 1024
3131

32-
// ImageLocality is a plugin that checks if a pod tolerates a node's taints.
32+
// ImageLocality is a score plugin that favors nodes that already have requested pod container's images.
3333
type ImageLocality struct {
3434
handle framework.FrameworkHandle
3535
}
3636

37-
var _ = framework.ScorePlugin(&ImageLocality{})
37+
var _ framework.ScorePlugin = &ImageLocality{}
3838

3939
// Name is the name of the plugin used in the plugin registry and configurations.
4040
const Name = "ImageLocality"

pkg/scheduler/framework/plugins/nodename/node_name.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
// NodeName is a plugin that checks if a pod spec node name matches the current node.
3131
type NodeName struct{}
3232

33-
var _ = framework.FilterPlugin(&NodeName{})
33+
var _ framework.FilterPlugin = &NodeName{}
3434

3535
// Name is the name of the plugin used in the plugin registry and configurations.
3636
const Name = "NodeName"

pkg/scheduler/framework/plugins/nodename/node_name_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ func TestNodeName(t *testing.T) {
3232
tests := []struct {
3333
pod *v1.Pod
3434
node *v1.Node
35-
fits bool
3635
name string
3736
wantStatus *framework.Status
3837
}{
3938
{
4039
pod: &v1.Pod{},
4140
node: &v1.Node{},
42-
fits: true,
4341
name: "no host specified",
4442
},
4543
{
@@ -53,7 +51,6 @@ func TestNodeName(t *testing.T) {
5351
Name: "foo",
5452
},
5553
},
56-
fits: true,
5754
name: "host matches",
5855
},
5956
{
@@ -67,7 +64,6 @@ func TestNodeName(t *testing.T) {
6764
Name: "foo",
6865
},
6966
},
70-
fits: false,
7167
name: "host doesn't match",
7268
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, predicates.ErrPodNotMatchHostName.GetReason()),
7369
},

pkg/scheduler/framework/plugins/nodeports/node_ports.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
// NodePorts is a plugin that checks if a node has free ports for the requested pod ports.
3131
type NodePorts struct{}
3232

33-
var _ = framework.FilterPlugin(&NodePorts{})
33+
var _ framework.FilterPlugin = &NodePorts{}
3434

3535
// Name is the name of the plugin used in the plugin registry and configurations.
3636
const Name = "NodePorts"

pkg/scheduler/framework/plugins/noderesources/node_resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
// NodeResources is a plugin that checks if a node has sufficient resources.
3232
type NodeResources struct{}
3333

34-
var _ = framework.FilterPlugin(&NodeResources{})
34+
var _ framework.FilterPlugin = &NodeResources{}
3535

3636
// Name is the name of the plugin used in the plugin registry and configurations.
3737
const Name = "NodeResources"

pkg/scheduler/framework/plugins/nodevolumelimits/node_volume_limits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package nodevolumelimits
1919
import (
2020
"context"
2121

22-
"k8s.io/api/core/v1"
22+
v1 "k8s.io/api/core/v1"
2323
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
2424
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration"
2525
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
@@ -31,7 +31,7 @@ type NodeVolumeLimits struct {
3131
predicate predicates.FitPredicate
3232
}
3333

34-
var _ = framework.FilterPlugin(&NodeVolumeLimits{})
34+
var _ framework.FilterPlugin = &NodeVolumeLimits{}
3535

3636
// Name is the name of the plugin used in the plugin registry and configurations.
3737
const Name = "NodeVolumeLimits"

0 commit comments

Comments
 (0)