example

package
v0.0.0-...-8ab94c9 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright @ 2021 bocloud <fushaosong@beyondcent.com>.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

评估添加pod到node的影响

func (*ExamplePlugin) Bind

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

节点和 Pod 绑定

func (*ExamplePlugin) Filter

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

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

func (*ExamplePlugin) Less

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

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

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

func (*ExamplePlugin) Permit

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

Pod 绑定之前的准入控制

func (*ExamplePlugin) PostBind

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

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

func (*ExamplePlugin) PostFilter

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

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

func (*ExamplePlugin) PreBind

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

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

func (*ExamplePlugin) PreFilter

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

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

func (*ExamplePlugin) PreFilterExtensions

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

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

func (*ExamplePlugin) PreScore

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

打分前的状态处理

func (*ExamplePlugin) RemovePod

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

评估删除pod到node的影响

func (*ExamplePlugin) Reserve

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

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

func (*ExamplePlugin) Score

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

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

func (*ExamplePlugin) ScoreExtensions

func (ep *ExamplePlugin) ScoreExtensions() framework.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
}

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

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