example

package
v0.0.0-...-59521d1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ExampleName = "Example-schedule"

Variables

This section is empty.

Functions

func New

New initializes a new plugin and returns it.

Types

type ExamplePlugin

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

func (*ExamplePlugin) AddPod

func (ep *ExamplePlugin) AddPod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

AddPod 评估添加pod到node的影响

func (*ExamplePlugin) Bind

func (ep *ExamplePlugin) Bind(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string) *framework.Status

Bind 节点和 Pod 绑定

func (*ExamplePlugin) Filter

func (ep *ExamplePlugin) Filter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, node *framework.NodeInfo) *framework.Status

Filter 过滤掉不符合当前 Pod 运行条件的Node(相当于旧版本的 predicate)

func (*ExamplePlugin) Less

func (ep *ExamplePlugin) Less(podInfo1, podInfo2 *framework.QueuedPodInfo) bool

Less Schedule Pod Queue排序规则

func (*ExamplePlugin) Name

func (ep *ExamplePlugin) Name() string

func (*ExamplePlugin) NormalizeScore

func (ep *ExamplePlugin) NormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status

NormalizeScore 在调度器为节点计算最终排名前修改节点排名。配合 Scoring 插件使用,为了平衡插件中的打分情况

func (*ExamplePlugin) Permit

func (ep *ExamplePlugin) Permit(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (*framework.Status, time.Duration)

Permit Pod 绑定之前的准入控制

func (*ExamplePlugin) PostBind

func (ep *ExamplePlugin) PostBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string)

PostBind Pod绑定成功后的资源清理逻辑

func (*ExamplePlugin) PostFilter

func (ep *ExamplePlugin) PostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)

PostFilter 在预选后被调用,通常用来记录日志和监控信息。也可以当做 “Pre-scoring” 插件的扩展点 Filter插件执行完后执行(一般用于 Pod 抢占逻辑的处理)

func (*ExamplePlugin) PreBind

func (ep *ExamplePlugin) PreBind(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string) *framework.Status

PreBind 绑定 Pod 之前的逻辑,如:先预挂载共享存储,查看是否正常挂载

func (*ExamplePlugin) PreFilter

func (ep *ExamplePlugin) PreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod) *framework.Status

PreFilter Pod 调度前的条件检查,如果检查不通过,直接结束本调度周期(过滤带有某些标签、annotation的pod)

func (*ExamplePlugin) PreFilterExtensions

func (ep *ExamplePlugin) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions prefilter扩展功能,评估add/remove pod的影响,如果不实现可返回nil PreFilter之后调用

func (*ExamplePlugin) PreScore

func (ep *ExamplePlugin) PreScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodes []*v1.Node) *framework.Status

PreScore 打分前的状态处理

func (*ExamplePlugin) RemovePod

func (ep *ExamplePlugin) RemovePod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *v1.Pod, podToRemove *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

RemovePod 评估删除pod到node的影响

func (*ExamplePlugin) Reserve

func (ep *ExamplePlugin) Reserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status

Reserve 与Unreserve成对出现 为给定的 Pod 预留节点上的资源,目的是为了防止资源竞争,并且是在绑定前做的;

func (*ExamplePlugin) Score

func (ep *ExamplePlugin) Score(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string) (int64, *framework.Status)

Score 对节点进行打分(相当于旧版本的 priorities)

func (*ExamplePlugin) ScoreExtensions

func (ep *ExamplePlugin) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions 打分后扩展,由此方法则可调用NormalizeScore

func (*ExamplePlugin) Unreserve

func (ep *ExamplePlugin) Unreserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string)

type StateStorage

type StateStorage struct {
	framework.Resource
}

StateStorage 存储状态,插件间数据传输

func (*StateStorage) Clone

func (s *StateStorage) Clone() framework.StateData

Clone the preFilter state.

Jump to

Keyboard shortcuts

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