nodenumber

package
v0.0.0-...-b7b0d94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the name of the plugin used in the plugin registry and configurations.
	Name = "NodeNumber"
)

Variables

View Source
var ErrNotExpectedPreScoreState = errors.New("unexpected pre score state")

Functions

func New

New initializes a new plugin and returns it.

Types

type NodeNumber

type NodeNumber struct {
	// contains filtered or unexported fields
}

NodeNumber is an example plugin that favors nodes that have the number suffix which is the same as the number suffix of the pod name. But if a reverse option is true, it favors nodes that have the number suffix which **isn't** the same as the number suffix of pod name.

For example: With reverse option false, when schedule a pod named Pod1, a Node named Node1 gets a lower score than a node named Node9.

NOTE: this plugin only handle single digit numbers only.

func (*NodeNumber) EventsToRegister

func (pl *NodeNumber) EventsToRegister() []framework.ClusterEvent

func (*NodeNumber) Name

func (pl *NodeNumber) Name() string

Name returns the name of the plugin. It is used in logs, etc.

func (*NodeNumber) PreScore

func (pl *NodeNumber) PreScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodes []*framework.NodeInfo) *framework.Status

func (*NodeNumber) Score

func (pl *NodeNumber) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)

Score invoked at the score extension point.

func (*NodeNumber) ScoreExtensions

func (pl *NodeNumber) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions of the Score plugin.

type NodeNumberArgs

type NodeNumberArgs struct {
	metav1.TypeMeta

	Reverse bool `json:"reverse"`
}

NodeNumberArgs is arguments for node number plugin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL