mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #100051 from tanjing2020/nodeaffinity
implement EnqueueExtensions interface in nodeaffinity
This commit is contained in:
commit
2b89558a1f
@ -38,6 +38,7 @@ type NodeAffinity struct {
|
|||||||
|
|
||||||
var _ framework.FilterPlugin = &NodeAffinity{}
|
var _ framework.FilterPlugin = &NodeAffinity{}
|
||||||
var _ framework.ScorePlugin = &NodeAffinity{}
|
var _ framework.ScorePlugin = &NodeAffinity{}
|
||||||
|
var _ framework.EnqueueExtensions = &NodeAffinity{}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
@ -70,6 +71,14 @@ func (s *preFilterState) Clone() framework.StateData {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EventsToRegister returns the possible events that may make a Pod
|
||||||
|
// failed by this plugin schedulable.
|
||||||
|
func (pl *NodeAffinity) EventsToRegister() []framework.ClusterEvent {
|
||||||
|
return []framework.ClusterEvent{
|
||||||
|
{Resource: framework.Node, ActionType: framework.Add | framework.UpdateNodeLabel},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// PreFilter builds and writes cycle state used by Filter.
|
// PreFilter builds and writes cycle state used by Filter.
|
||||||
func (pl *NodeAffinity) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) *framework.Status {
|
func (pl *NodeAffinity) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) *framework.Status {
|
||||||
state := &preFilterState{requiredNodeSelectorAndAffinity: nodeaffinity.GetRequiredNodeAffinity(pod)}
|
state := &preFilterState{requiredNodeSelectorAndAffinity: nodeaffinity.GetRequiredNodeAffinity(pod)}
|
||||||
|
Loading…
Reference in New Issue
Block a user