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 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{}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -622,6 +622,15 @@ func autoConvert_v1beta1_Plugins_To_config_Plugins(in *v1beta1.Plugins, out *con
|
|||||||
} else {
|
} else {
|
||||||
out.Filter = nil
|
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 {
|
if in.PreScore != nil {
|
||||||
in, out := &in.PreScore, &out.PreScore
|
in, out := &in.PreScore, &out.PreScore
|
||||||
*out = new(config.PluginSet)
|
*out = new(config.PluginSet)
|
||||||
@ -730,6 +739,15 @@ func autoConvert_config_Plugins_To_v1beta1_Plugins(in *config.Plugins, out *v1be
|
|||||||
} else {
|
} else {
|
||||||
out.Filter = nil
|
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 {
|
if in.PreScore != nil {
|
||||||
in, out := &in.PreScore, &out.PreScore
|
in, out := &in.PreScore, &out.PreScore
|
||||||
*out = new(v1beta1.PluginSet)
|
*out = new(v1beta1.PluginSet)
|
||||||
|
@ -445,6 +445,11 @@ func (in *Plugins) DeepCopyInto(out *Plugins) {
|
|||||||
*out = new(PluginSet)
|
*out = new(PluginSet)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
|
if in.PostFilter != nil {
|
||||||
|
in, out := &in.PostFilter, &out.PostFilter
|
||||||
|
*out = new(PluginSet)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
if in.PreScore != nil {
|
if in.PreScore != nil {
|
||||||
in, out := &in.PreScore, &out.PreScore
|
in, out := &in.PreScore, &out.PreScore
|
||||||
*out = new(PluginSet)
|
*out = new(PluginSet)
|
||||||
|
@ -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"`
|
||||||
|
|
||||||
|
@ -387,6 +387,11 @@ func (in *Plugins) DeepCopyInto(out *Plugins) {
|
|||||||
*out = new(PluginSet)
|
*out = new(PluginSet)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
|
if in.PostFilter != nil {
|
||||||
|
in, out := &in.PostFilter, &out.PostFilter
|
||||||
|
*out = new(PluginSet)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
if in.PreScore != nil {
|
if in.PreScore != nil {
|
||||||
in, out := &in.PreScore, &out.PreScore
|
in, out := &in.PreScore, &out.PreScore
|
||||||
*out = new(PluginSet)
|
*out = new(PluginSet)
|
||||||
|
Loading…
Reference in New Issue
Block a user