@@ -34,6 +34,7 @@ type framework struct {
34
34
nodeInfoSnapshot * cache.NodeInfoSnapshot
35
35
waitingPods * waitingPodsMap
36
36
plugins map [string ]Plugin // a map of initialized plugins. Plugin name:plugin instance.
37
+ queueSortPlugins []QueueSortPlugin
37
38
reservePlugins []ReservePlugin
38
39
prebindPlugins []PrebindPlugin
39
40
unreservePlugins []UnreservePlugin
@@ -69,6 +70,10 @@ func NewFramework(r Registry, _ *runtime.Unknown) (Framework, error) {
69
70
// TODO: For now, we assume any plugins that implements an extension
70
71
// point wants to be called at that extension point. We should change this
71
72
// later and add these plugins based on the configuration.
73
+ if qsp , ok := p .(QueueSortPlugin ); ok {
74
+ f .queueSortPlugins = append (f .queueSortPlugins , qsp )
75
+ }
76
+
72
77
if rp , ok := p .(ReservePlugin ); ok {
73
78
f .reservePlugins = append (f .reservePlugins , rp )
74
79
}
@@ -85,6 +90,16 @@ func NewFramework(r Registry, _ *runtime.Unknown) (Framework, error) {
85
90
return f , nil
86
91
}
87
92
93
+ // QueueSortFunc returns the function to sort pods in scheduling queue
94
+ func (f * framework ) QueueSortFunc () LessFunc {
95
+ if len (f .queueSortPlugins ) == 0 {
96
+ return nil
97
+ }
98
+
99
+ // Only one QueueSort plugin can be enabled.
100
+ return f .queueSortPlugins [0 ].Less
101
+ }
102
+
88
103
// RunPrebindPlugins runs the set of configured prebind plugins. It returns a
89
104
// failure (bool) if any of the plugins returns an error. It also returns an
90
105
// error containing the rejection message or the error occurred in the plugin.
0 commit comments