mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Scheduler PostFilter API
This commit is contained in:
parent
1d566466cf
commit
1837b49554
@ -190,6 +190,9 @@ type Plugins struct {
|
|||||||
// Filter is a list of plugins that should be invoked when filtering out nodes that cannot run the Pod.
|
// Filter is a list of plugins that should be invoked when filtering out nodes that cannot run the Pod.
|
||||||
Filter *PluginSet
|
Filter *PluginSet
|
||||||
|
|
||||||
|
// PostFilter is a list of plugins that are invoked after filtering phase, no matter whether filtering succeeds or not.
|
||||||
|
PostFilter *PluginSet
|
||||||
|
|
||||||
// PreScore is a list of plugins that are invoked before scoring.
|
// PreScore is a list of plugins that are invoked before scoring.
|
||||||
PreScore *PluginSet
|
PreScore *PluginSet
|
||||||
|
|
||||||
@ -284,6 +287,7 @@ func (p *Plugins) Append(src *Plugins) {
|
|||||||
p.QueueSort = appendPluginSet(p.QueueSort, src.QueueSort)
|
p.QueueSort = appendPluginSet(p.QueueSort, src.QueueSort)
|
||||||
p.PreFilter = appendPluginSet(p.PreFilter, src.PreFilter)
|
p.PreFilter = appendPluginSet(p.PreFilter, src.PreFilter)
|
||||||
p.Filter = appendPluginSet(p.Filter, src.Filter)
|
p.Filter = appendPluginSet(p.Filter, src.Filter)
|
||||||
|
p.PostFilter = appendPluginSet(p.PostFilter, src.PostFilter)
|
||||||
p.PreScore = appendPluginSet(p.PreScore, src.PreScore)
|
p.PreScore = appendPluginSet(p.PreScore, src.PreScore)
|
||||||
p.Score = appendPluginSet(p.Score, src.Score)
|
p.Score = appendPluginSet(p.Score, src.Score)
|
||||||
p.Reserve = appendPluginSet(p.Reserve, src.Reserve)
|
p.Reserve = appendPluginSet(p.Reserve, src.Reserve)
|
||||||
@ -303,6 +307,7 @@ func (p *Plugins) Apply(customPlugins *Plugins) {
|
|||||||
p.QueueSort = mergePluginSets(p.QueueSort, customPlugins.QueueSort)
|
p.QueueSort = mergePluginSets(p.QueueSort, customPlugins.QueueSort)
|
||||||
p.PreFilter = mergePluginSets(p.PreFilter, customPlugins.PreFilter)
|
p.PreFilter = mergePluginSets(p.PreFilter, customPlugins.PreFilter)
|
||||||
p.Filter = mergePluginSets(p.Filter, customPlugins.Filter)
|
p.Filter = mergePluginSets(p.Filter, customPlugins.Filter)
|
||||||
|
p.PostFilter = mergePluginSets(p.PostFilter, customPlugins.PostFilter)
|
||||||
p.PreScore = mergePluginSets(p.PreScore, customPlugins.PreScore)
|
p.PreScore = mergePluginSets(p.PreScore, customPlugins.PreScore)
|
||||||
p.Score = mergePluginSets(p.Score, customPlugins.Score)
|
p.Score = mergePluginSets(p.Score, customPlugins.Score)
|
||||||
p.Reserve = mergePluginSets(p.Reserve, customPlugins.Reserve)
|
p.Reserve = mergePluginSets(p.Reserve, customPlugins.Reserve)
|
||||||
|
@ -56,14 +56,15 @@ func TestPluginsAppend(t *testing.T) {
|
|||||||
{Name: "CustomPlugin"},
|
{Name: "CustomPlugin"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PreScore: &PluginSet{},
|
PostFilter: &PluginSet{},
|
||||||
Score: &PluginSet{},
|
PreScore: &PluginSet{},
|
||||||
Reserve: &PluginSet{},
|
Score: &PluginSet{},
|
||||||
Permit: &PluginSet{},
|
Reserve: &PluginSet{},
|
||||||
PreBind: &PluginSet{},
|
Permit: &PluginSet{},
|
||||||
Bind: &PluginSet{},
|
PreBind: &PluginSet{},
|
||||||
PostBind: &PluginSet{},
|
Bind: &PluginSet{},
|
||||||
Unreserve: &PluginSet{},
|
PostBind: &PluginSet{},
|
||||||
|
Unreserve: &PluginSet{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -117,14 +118,15 @@ func TestPluginsApply(t *testing.T) {
|
|||||||
{Name: "CustomPlugin"},
|
{Name: "CustomPlugin"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||||
Score: &PluginSet{Enabled: []Plugin{}},
|
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
Score: &PluginSet{Enabled: []Plugin{}},
|
||||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
|
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -158,14 +160,15 @@ func TestPluginsApply(t *testing.T) {
|
|||||||
{Name: "DefaultPlugin2"},
|
{Name: "DefaultPlugin2"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||||
Score: &PluginSet{Enabled: []Plugin{}},
|
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
Score: &PluginSet{Enabled: []Plugin{}},
|
||||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
|
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -200,14 +203,15 @@ func TestPluginsApply(t *testing.T) {
|
|||||||
{Name: "DefaultPlugin2"},
|
{Name: "DefaultPlugin2"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||||
Score: &PluginSet{Enabled: []Plugin{}},
|
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
Score: &PluginSet{Enabled: []Plugin{}},
|
||||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
|
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -240,14 +244,15 @@ func TestPluginsApply(t *testing.T) {
|
|||||||
{Name: "DefaultPlugin1"},
|
{Name: "DefaultPlugin1"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||||
Score: &PluginSet{Enabled: []Plugin{}},
|
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
Score: &PluginSet{Enabled: []Plugin{}},
|
||||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||||
|
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,8 @@ func TestRegisterConfigProducers(t *testing.T) {
|
|||||||
{Name: testFilterName2},
|
{Name: testFilterName2},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PreScore: &config.PluginSet{},
|
PostFilter: &config.PluginSet{},
|
||||||
|
PreScore: &config.PluginSet{},
|
||||||
Score: &config.PluginSet{
|
Score: &config.PluginSet{
|
||||||
Enabled: []config.Plugin{
|
Enabled: []config.Plugin{
|
||||||
{Name: testScoreName1, Weight: 1},
|
{Name: testScoreName1, Weight: 1},
|
||||||
|
@ -173,6 +173,9 @@ type Plugins struct {
|
|||||||
// Filter is a list of plugins that should be invoked when filtering out nodes that cannot run the Pod.
|
// Filter is a list of plugins that should be invoked when filtering out nodes that cannot run the Pod.
|
||||||
Filter *PluginSet `json:"filter,omitempty"`
|
Filter *PluginSet `json:"filter,omitempty"`
|
||||||
|
|
||||||
|
// PostFilter is a list of plugins that are invoked after filtering phase, no matter whether filtering succeeds or not.
|
||||||
|
PostFilter *PluginSet `json:"postFilter,omitempty"`
|
||||||
|
|
||||||
// PreScore is a list of plugins that are invoked before scoring.
|
// PreScore is a list of plugins that are invoked before scoring.
|
||||||
PreScore *PluginSet `json:"preScore,omitempty"`
|
PreScore *PluginSet `json:"preScore,omitempty"`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user