mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Modified the name of the Extensions method in the scheduler's framework.
This commit is contained in:
parent
ca038117b2
commit
043166f54b
@ -635,7 +635,7 @@ func (t *TestPlugin) Score(state *framework.CycleState, p *v1.Pod, nodeName stri
|
|||||||
return 1, nil
|
return 1, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TestPlugin) Extensions() framework.ScoreExtensions {
|
func (t *TestPlugin) ScoreExtensions() framework.ScoreExtensions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,10 +229,10 @@ func (f *framework) RunPreFilterPlugins(
|
|||||||
func (f *framework) RunPreFilterExtensionAddPod(state *CycleState, podToSchedule *v1.Pod,
|
func (f *framework) RunPreFilterExtensionAddPod(state *CycleState, podToSchedule *v1.Pod,
|
||||||
podToAdd *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
|
podToAdd *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
|
||||||
for _, pl := range f.preFilterPlugins {
|
for _, pl := range f.preFilterPlugins {
|
||||||
if pl.Extensions() == nil {
|
if pl.PreFilterExtensions() == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if status := pl.Extensions().AddPod(state, podToSchedule, podToAdd, nodeInfo); !status.IsSuccess() {
|
if status := pl.PreFilterExtensions().AddPod(state, podToSchedule, podToAdd, nodeInfo); !status.IsSuccess() {
|
||||||
msg := fmt.Sprintf("error while running AddPod for plugin %q while scheduling pod %q: %v",
|
msg := fmt.Sprintf("error while running AddPod for plugin %q while scheduling pod %q: %v",
|
||||||
pl.Name(), podToSchedule.Name, status.Message())
|
pl.Name(), podToSchedule.Name, status.Message())
|
||||||
klog.Error(msg)
|
klog.Error(msg)
|
||||||
@ -249,10 +249,10 @@ func (f *framework) RunPreFilterExtensionAddPod(state *CycleState, podToSchedule
|
|||||||
func (f *framework) RunPreFilterExtensionRemovePod(state *CycleState, podToSchedule *v1.Pod,
|
func (f *framework) RunPreFilterExtensionRemovePod(state *CycleState, podToSchedule *v1.Pod,
|
||||||
podToRemove *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
|
podToRemove *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
|
||||||
for _, pl := range f.preFilterPlugins {
|
for _, pl := range f.preFilterPlugins {
|
||||||
if pl.Extensions() == nil {
|
if pl.PreFilterExtensions() == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if status := pl.Extensions().RemovePod(state, podToSchedule, podToRemove, nodeInfo); !status.IsSuccess() {
|
if status := pl.PreFilterExtensions().RemovePod(state, podToSchedule, podToRemove, nodeInfo); !status.IsSuccess() {
|
||||||
msg := fmt.Sprintf("error while running RemovePod for plugin %q while scheduling pod %q: %v",
|
msg := fmt.Sprintf("error while running RemovePod for plugin %q while scheduling pod %q: %v",
|
||||||
pl.Name(), podToSchedule.Name, status.Message())
|
pl.Name(), podToSchedule.Name, status.Message())
|
||||||
klog.Error(msg)
|
klog.Error(msg)
|
||||||
@ -343,10 +343,10 @@ func (f *framework) RunScorePlugins(state *CycleState, pod *v1.Pod, nodes []*v1.
|
|||||||
workqueue.ParallelizeUntil(ctx, 16, len(f.scorePlugins), func(index int) {
|
workqueue.ParallelizeUntil(ctx, 16, len(f.scorePlugins), func(index int) {
|
||||||
pl := f.scorePlugins[index]
|
pl := f.scorePlugins[index]
|
||||||
nodeScoreList := pluginToNodeScores[pl.Name()]
|
nodeScoreList := pluginToNodeScores[pl.Name()]
|
||||||
if pl.Extensions() == nil {
|
if pl.ScoreExtensions() == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if status := pl.Extensions().NormalizeScore(state, pod, nodeScoreList); !status.IsSuccess() {
|
if status := pl.ScoreExtensions().NormalizeScore(state, pod, nodeScoreList); !status.IsSuccess() {
|
||||||
err := fmt.Errorf("normalize score plugin %q failed with error %v", pl.Name(), status.Message())
|
err := fmt.Errorf("normalize score plugin %q failed with error %v", pl.Name(), status.Message())
|
||||||
errCh.SendErrorWithCancel(err, cancel)
|
errCh.SendErrorWithCancel(err, cancel)
|
||||||
return
|
return
|
||||||
|
@ -89,7 +89,7 @@ func (pl *TestScoreWithNormalizePlugin) Score(state *CycleState, p *v1.Pod, node
|
|||||||
return setScoreRes(pl.inj)
|
return setScoreRes(pl.inj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pl *TestScoreWithNormalizePlugin) Extensions() ScoreExtensions {
|
func (pl *TestScoreWithNormalizePlugin) ScoreExtensions() ScoreExtensions {
|
||||||
return pl
|
return pl
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ func (pl *TestScorePlugin) Score(state *CycleState, p *v1.Pod, nodeName string)
|
|||||||
return setScoreRes(pl.inj)
|
return setScoreRes(pl.inj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pl *TestScorePlugin) Extensions() ScoreExtensions {
|
func (pl *TestScorePlugin) ScoreExtensions() ScoreExtensions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ func (pl *TestPreFilterPlugin) PreFilter(state *CycleState, p *v1.Pod) *Status {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pl *TestPreFilterPlugin) Extensions() PreFilterExtensions {
|
func (pl *TestPreFilterPlugin) PreFilterExtensions() PreFilterExtensions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ func (pl *TestPreFilterWithExtensionsPlugin) RemovePod(state *CycleState, podToS
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pl *TestPreFilterWithExtensionsPlugin) Extensions() PreFilterExtensions {
|
func (pl *TestPreFilterWithExtensionsPlugin) PreFilterExtensions() PreFilterExtensions {
|
||||||
return pl
|
return pl
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ func (dp *TestDuplicatePlugin) PreFilter(state *CycleState, p *v1.Pod) *Status {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dp *TestDuplicatePlugin) Extensions() PreFilterExtensions {
|
func (dp *TestDuplicatePlugin) PreFilterExtensions() PreFilterExtensions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,13 +190,13 @@ type PreFilterPlugin interface {
|
|||||||
// PreFilter is called at the beginning of the scheduling cycle. All PreFilter
|
// PreFilter is called at the beginning of the scheduling cycle. All PreFilter
|
||||||
// plugins must return success or the pod will be rejected.
|
// plugins must return success or the pod will be rejected.
|
||||||
PreFilter(state *CycleState, p *v1.Pod) *Status
|
PreFilter(state *CycleState, p *v1.Pod) *Status
|
||||||
// Extensions returns a PreFilterExtensions interface if the plugin implements one,
|
// PreFilterExtensions returns a PreFilterExtensions interface if the plugin implements one,
|
||||||
// or nil if it does not. A Pre-filter plugin can provide extensions to incrementally
|
// or nil if it does not. A Pre-filter plugin can provide extensions to incrementally
|
||||||
// modify its pre-processed info. The framework guarantees that the extensions
|
// modify its pre-processed info. The framework guarantees that the extensions
|
||||||
// AddPod/RemovePod will only be called after PreFilter, possibly on a cloned
|
// AddPod/RemovePod will only be called after PreFilter, possibly on a cloned
|
||||||
// CycleState, and may call those functions more than once before calling
|
// CycleState, and may call those functions more than once before calling
|
||||||
// Filter again on a specific node.
|
// Filter again on a specific node.
|
||||||
Extensions() PreFilterExtensions
|
PreFilterExtensions() PreFilterExtensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// FilterPlugin is an interface for Filter plugins. These plugins are called at the
|
// FilterPlugin is an interface for Filter plugins. These plugins are called at the
|
||||||
@ -253,8 +253,8 @@ type ScorePlugin interface {
|
|||||||
// the pod will be rejected.
|
// the pod will be rejected.
|
||||||
Score(state *CycleState, p *v1.Pod, nodeName string) (int, *Status)
|
Score(state *CycleState, p *v1.Pod, nodeName string) (int, *Status)
|
||||||
|
|
||||||
// Extensions returns a ScoreExtensions interface if it implements one, or nil if does not.
|
// ScoreExtensions returns a ScoreExtensions interface if it implements one, or nil if does not.
|
||||||
Extensions() ScoreExtensions
|
ScoreExtensions() ScoreExtensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReservePlugin is an interface for Reserve plugins. These plugins are called
|
// ReservePlugin is an interface for Reserve plugins. These plugins are called
|
||||||
|
@ -163,7 +163,7 @@ func (sp *ScorePlugin) Score(state *framework.CycleState, p *v1.Pod, nodeName st
|
|||||||
return score, nil
|
return score, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sp *ScorePlugin) Extensions() framework.ScoreExtensions {
|
func (sp *ScorePlugin) ScoreExtensions() framework.ScoreExtensions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ func (sp *ScoreWithNormalizePlugin) NormalizeScore(state *framework.CycleState,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sp *ScoreWithNormalizePlugin) Extensions() framework.ScoreExtensions {
|
func (sp *ScoreWithNormalizePlugin) ScoreExtensions() framework.ScoreExtensions {
|
||||||
return sp
|
return sp
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ func (pp *PreFilterPlugin) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extensions returns the PreFilterExtensions interface.
|
// Extensions returns the PreFilterExtensions interface.
|
||||||
func (pp *PreFilterPlugin) Extensions() framework.PreFilterExtensions {
|
func (pp *PreFilterPlugin) PreFilterExtensions() framework.PreFilterExtensions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ func (fp *tokenFilter) RemovePod(state *framework.CycleState, podToSchedule *v1.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fp *tokenFilter) Extensions() framework.PreFilterExtensions {
|
func (fp *tokenFilter) PreFilterExtensions() framework.PreFilterExtensions {
|
||||||
return fp
|
return fp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user