mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #91547 from Huang-Wei/postfilter-api
Scheduler PostFilter API
This commit is contained in:
commit
6a526e8633
@ -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 *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 *PluginSet
|
||||
|
||||
@ -284,6 +287,7 @@ func (p *Plugins) Append(src *Plugins) {
|
||||
p.QueueSort = appendPluginSet(p.QueueSort, src.QueueSort)
|
||||
p.PreFilter = appendPluginSet(p.PreFilter, src.PreFilter)
|
||||
p.Filter = appendPluginSet(p.Filter, src.Filter)
|
||||
p.PostFilter = appendPluginSet(p.PostFilter, src.PostFilter)
|
||||
p.PreScore = appendPluginSet(p.PreScore, src.PreScore)
|
||||
p.Score = appendPluginSet(p.Score, src.Score)
|
||||
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.PreFilter = mergePluginSets(p.PreFilter, customPlugins.PreFilter)
|
||||
p.Filter = mergePluginSets(p.Filter, customPlugins.Filter)
|
||||
p.PostFilter = mergePluginSets(p.PostFilter, customPlugins.PostFilter)
|
||||
p.PreScore = mergePluginSets(p.PreScore, customPlugins.PreScore)
|
||||
p.Score = mergePluginSets(p.Score, customPlugins.Score)
|
||||
p.Reserve = mergePluginSets(p.Reserve, customPlugins.Reserve)
|
||||
|
@ -56,14 +56,15 @@ func TestPluginsAppend(t *testing.T) {
|
||||
{Name: "CustomPlugin"},
|
||||
},
|
||||
},
|
||||
PreScore: &PluginSet{},
|
||||
Score: &PluginSet{},
|
||||
Reserve: &PluginSet{},
|
||||
Permit: &PluginSet{},
|
||||
PreBind: &PluginSet{},
|
||||
Bind: &PluginSet{},
|
||||
PostBind: &PluginSet{},
|
||||
Unreserve: &PluginSet{},
|
||||
PostFilter: &PluginSet{},
|
||||
PreScore: &PluginSet{},
|
||||
Score: &PluginSet{},
|
||||
Reserve: &PluginSet{},
|
||||
Permit: &PluginSet{},
|
||||
PreBind: &PluginSet{},
|
||||
Bind: &PluginSet{},
|
||||
PostBind: &PluginSet{},
|
||||
Unreserve: &PluginSet{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -117,14 +118,15 @@ func TestPluginsApply(t *testing.T) {
|
||||
{Name: "CustomPlugin"},
|
||||
},
|
||||
},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -158,14 +160,15 @@ func TestPluginsApply(t *testing.T) {
|
||||
{Name: "DefaultPlugin2"},
|
||||
},
|
||||
},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -200,14 +203,15 @@ func TestPluginsApply(t *testing.T) {
|
||||
{Name: "DefaultPlugin2"},
|
||||
},
|
||||
},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -240,14 +244,15 @@ func TestPluginsApply(t *testing.T) {
|
||||
{Name: "DefaultPlugin1"},
|
||||
},
|
||||
},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
PostFilter: &PluginSet{Enabled: []Plugin{}},
|
||||
PreScore: &PluginSet{Enabled: []Plugin{}},
|
||||
Score: &PluginSet{Enabled: []Plugin{}},
|
||||
Reserve: &PluginSet{Enabled: []Plugin{}},
|
||||
Permit: &PluginSet{Enabled: []Plugin{}},
|
||||
PreBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Bind: &PluginSet{Enabled: []Plugin{}},
|
||||
PostBind: &PluginSet{Enabled: []Plugin{}},
|
||||
Unreserve: &PluginSet{Enabled: []Plugin{}},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -622,6 +622,15 @@ func autoConvert_v1beta1_Plugins_To_config_Plugins(in *v1beta1.Plugins, out *con
|
||||
} else {
|
||||
out.Filter = nil
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(config.PluginSet)
|
||||
if err := Convert_v1beta1_PluginSet_To_config_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PostFilter = nil
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(config.PluginSet)
|
||||
@ -730,6 +739,15 @@ func autoConvert_config_Plugins_To_v1beta1_Plugins(in *config.Plugins, out *v1be
|
||||
} else {
|
||||
out.Filter = nil
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(v1beta1.PluginSet)
|
||||
if err := Convert_config_PluginSet_To_v1beta1_PluginSet(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PostFilter = nil
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(v1beta1.PluginSet)
|
||||
|
@ -445,6 +445,11 @@ func (in *Plugins) DeepCopyInto(out *Plugins) {
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(PluginSet)
|
||||
|
@ -102,7 +102,8 @@ func TestRegisterConfigProducers(t *testing.T) {
|
||||
{Name: testFilterName2},
|
||||
},
|
||||
},
|
||||
PreScore: &config.PluginSet{},
|
||||
PostFilter: &config.PluginSet{},
|
||||
PreScore: &config.PluginSet{},
|
||||
Score: &config.PluginSet{
|
||||
Enabled: []config.Plugin{
|
||||
{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 *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 *PluginSet `json:"preScore,omitempty"`
|
||||
|
||||
|
@ -387,6 +387,11 @@ func (in *Plugins) DeepCopyInto(out *Plugins) {
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PostFilter != nil {
|
||||
in, out := &in.PostFilter, &out.PostFilter
|
||||
*out = new(PluginSet)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PreScore != nil {
|
||||
in, out := &in.PreScore, &out.PreScore
|
||||
*out = new(PluginSet)
|
||||
|
Loading…
Reference in New Issue
Block a user