plugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ResultStoreKey = "PluginResultStoreKey"

ResultStoreKey represents key name of plugins results on sharedstore.

Variables

This section is empty.

Functions

func ConvertForSimulator

func ConvertForSimulator(pls *configv1.Plugins) (*configv1.Plugins, error)

ConvertForSimulator convert configv1.Plugins for simulator.

func NewPluginConfig

func NewPluginConfig(pc []configv1.PluginConfig) ([]configv1.PluginConfig, error)

NewPluginConfig converts []configv1.PluginConfig for simulator. Passed []v1beta.PluginConfig overrides default config values.

NewPluginConfig expects that either PluginConfig.Args.Raw or PluginConfig.Args.Object has data in the passed configv1.PluginConfig parameter. If data exists in both PluginConfig.Args.Raw and PluginConfig.Args.Object, PluginConfig.Args.Raw would be ignored since PluginConfig.Args.Object has higher priority.

func NewWrappedPlugin

func NewWrappedPlugin(s Store, p framework.Plugin, opts ...Option) framework.Plugin

NewWrappedPlugin makes wrappedPlugin from score or/and filter plugin.

Types

type BindPluginExtender

type BindPluginExtender interface {
	// BeforeBind is a function that runs before the Bind method of the original plugin.
	// If BeforeBind returns non-success status, the simulator plugin doesn't run the Bind method of the original plugin and return that status.
	BeforeBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string) *framework.Status
	// AfterBind is a function that is run after the Bind method of the original plugin.
	// A Bind of the simulator plugin finally returns the status returned from AfterBind.
	AfterBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string, bindResult *framework.Status) *framework.Status
}

type FilterPluginExtender

type FilterPluginExtender interface {
	// BeforeFilter is a function that runs before the Filter method of the original plugin.
	// If BeforeFilter returns non-success status, the simulator plugin doesn't run the Filter method of the original plugin and return that status.
	BeforeFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status
	// AfterFilter is a function that is run after the Filter method of the original plugin.
	// A Filter of the simulator plugin finally returns the status returned from AfterFilter.
	AfterFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo, filterResult *framework.Status) *framework.Status
}

FilterPluginExtender is the extender for Filter plugin.

type NormalizeScorePluginExtender

type NormalizeScorePluginExtender interface {
	// BeforeNormalizeScore is a function that runs before the NormalizeScore method of the original plugin.
	// If BeforeNormalizeScore returns non-success status, the simulator plugin doesn't run the NormalizeScore method of the original plugin and return that status.
	BeforeNormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status
	// AfterNormalizeScore is a function that runs after the NormalizeScore method of the original plugin.
	// A NormalizeScore of the simulator plugins finally returns the status returned from AfterNormalizeScore.
	AfterNormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList, normalizeScoreResult *framework.Status) *framework.Status
}

NormalizeScorePluginExtender is the extender for NormalizeScore plugin.

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithExtendersOption

func WithExtendersOption(opt PluginExtenderInitializer) Option

WithExtendersOption provides an easy way to extend the behavior of the plugin. These containing functions in PluginExtenders should be run before and after the original plugin of Scheduler Framework.

func WithPluginNameOption

func WithPluginNameOption(opt *string) Option

WithPluginNameOption contains configuration options for the name field of a wrappedPlugin.

type PermitPluginExtender

type PermitPluginExtender interface {
	// BeforePermit is a function that runs before the Permit method of the original plugin.
	// If BeforePermit returns non-success status, the simulator plugin doesn't run the Permit method of the original plugin and return that status.
	BeforePermit(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (*framework.Status, time.Duration)
	// AfterPermit is a function that runs after the Permit method of the original plugin.
	// A Permit of the simulator plugins finally returns the status returned from AfterPermit.
	AfterPermit(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string, permitResult *framework.Status, timeout time.Duration) (*framework.Status, time.Duration)
}

PermitPluginExtender is the extender for Permit plugin.

type PluginExtenderInitializer

type PluginExtenderInitializer func(handle SimulatorHandle) PluginExtenders

type PluginExtenders

type PluginExtenders struct {
	PreFilterPluginExtender      PreFilterPluginExtender
	FilterPluginExtender         FilterPluginExtender
	PostFilterPluginExtender     PostFilterPluginExtender
	PreScorePluginExtender       PreScorePluginExtender
	ScorePluginExtender          ScorePluginExtender
	NormalizeScorePluginExtender NormalizeScorePluginExtender
	PermitPluginExtender         PermitPluginExtender
	ReservePluginExtender        ReservePluginExtender
	PreBindPluginExtender        PreBindPluginExtender
	BindPluginExtender           BindPluginExtender
	PostBindPluginExtender       PostBindPluginExtender
}

PluginExtenders contains XXXXPluginExtenders. Each extender will intercept a calling to target method call of scheduler plugins, and you can check/modify requests and/or results.

type PostBindPluginExtender

type PostBindPluginExtender interface {
	// BeforePostBind is a function that runs before the PostBind method of the original plugin.
	// If BeforePostBind returns non-success status, the simulator plugin doesn't run the PostBind method of the original plugin and return that status.
	BeforePostBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string) *framework.Status
	// AfterPostBind is a function that is run after the PostBind method of the original plugin.
	AfterPostBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string)
}

type PostFilterPluginExtender

type PostFilterPluginExtender interface {
	// BeforePostFilter is a function that is run before the PostFilter method of the original plugin.
	// If BeforePostFilter return non-success status, the simulator plugin doesn't run the PostFilter method of the original plugin and return that status.
	BeforePostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, filteredNodeStatusMap framework.NodeToStatusMap) (*framework.PostFilterResult, *framework.Status)
	// AfterPostFilter is a function that is run after the PostFilter method of the original plugin.
	// A PostFilter of the simulator plugin finally returns the status returned from PostFilter.
	AfterPostFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, filteredNodeStatusMap framework.NodeToStatusMap, postFilterResult *framework.PostFilterResult, status *framework.Status) (*framework.PostFilterResult, *framework.Status)
}

type PreBindPluginExtender

type PreBindPluginExtender interface {
	// BeforePreBind is a function that runs before the PreBind method of the original plugin.
	// If BeforePreBind returns non-success status, the simulator plugin doesn't run the PreBind method of the original plugin and return that status.
	BeforePreBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string) *framework.Status
	// AfterPreBind is a function that is run after the Bind method of the original plugin.
	// A PreBind of the simulator plugin finally returns the status returned from AfterBind.
	AfterPreBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string, bindResult *framework.Status) *framework.Status
}

type PreFilterPluginExtender

type PreFilterPluginExtender interface {
	// BeforePreFilter is a function that runs before the PreFilter method of the original plugin.
	// If BeforePreFilter returns non-success status, the simulator plugin doesn't run the PreFilter method of the original plugin and return that status.
	BeforePreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status)
	// AfterPreFilter is a function that is run after the PreFilter method of the original plugin.
	// A PreFilter of the simulator plugin finally returns the PreFilterResult and the status returned from AfterPreFilter.
	AfterPreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, preFilterResult *framework.PreFilterResult, preFilterStatus *framework.Status) (*framework.PreFilterResult, *framework.Status)
}

PreFilterPluginExtender is the extender for PreFilter plugin.

type PreScorePluginExtender

type PreScorePluginExtender interface {
	// BeforePreScore is a function that runs before the PreFilter method of the original plugin.
	// If BeforePreScore returns non-success status, the simulator plugin doesn't run the PreScore method of the original plugin and return that status.
	BeforePreScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodes []*v1.Node) *framework.Status
	// AfterPreScore is a function that is run after the PreScore method of the original plugin.
	// A PreScore of the simulator plugin finally returns the status returned from AfterPreScore.
	AfterPreScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodes []*v1.Node, preScoreStatus *framework.Status) *framework.Status
}

type ReservePluginExtender

type ReservePluginExtender interface {
	// BeforeReserve is a function that runs before the Reserve method of the original plugin.
	// If BeforeReserve returns non-success status, the simulator plugin doesn't run the Reserve method of the original plugin and return that status.
	BeforeReserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string) *framework.Status
	// AfterReserve is a function that is run after the Reserve method of the original plugin.
	// A Reserve of the simulator plugin finally returns the status returned from AfterReserve.
	AfterReserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string, reserveStatus *framework.Status) *framework.Status
	// BeforeUnreserve is a function that runs before the Reserve method of the original plugin.
	// If BeforeUnreserve returns non-success status, the simulator plugin doesn't run the Reserve method of the original plugin.
	BeforeUnreserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string) *framework.Status
	// AfterUnreserve is a function that is run after the Unreserve method of the original plugin.
	AfterUnreserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodename string)
}

ReservePluginExtender is the extender for Reserve plugin.

type ScorePluginExtender

type ScorePluginExtender interface {
	// BeforeScore is a function that runs before the Score method of the original plugin.
	// If BeforeScore returns non-success status, the simulator plugin doesn't run the Score method of the original plugin and return that score & status.
	BeforeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)
	// AfterScore is a function that runs after the Score method of the original plugin.
	// A Score of the simulator plugin finally returns the score & status returned from AfterScore.
	AfterScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string, score int64, scoreResult *framework.Status) (int64, *framework.Status)
}

ScorePluginExtender is the extender for Score plugin.

type SimulatorHandle

type SimulatorHandle interface {
	// AddCustomResult adds user defined data.
	// The results added through this func is reflected on the Pod's annotation eventually like other scheduling results.
	// This function is intended to be called from the plugin.PluginExtender; allow users to export some internal state on Pods for debugging purpose.
	// For example,
	// Calling AddCustomResult in NodeAffinity's PreFilterPluginExtender:
	// AddCustomResult("namespace", "incomingPod", "node-affinity-filter-internal-state-anno-key", "internal-state")
	// Then, "incomingPod" Pod will get {"node-affinity-filter-internal-state-anno-key": "internal-state"} annotation after scheduling.
	AddCustomResult(namespace, podName, annotationKey, result string)
}

type Store

type Store interface {
	AddNormalizedScoreResult(namespace, podName, nodeName, pluginName string, normalizedscore int64)
	AddPreFilterResult(namespace, podName, pluginName, reason string, preFilterResult *framework.PreFilterResult)
	AddFilterResult(namespace, podName, nodeName, pluginName, reason string)
	AddPreScoreResult(namespace, podName, pluginName, reason string)
	AddScoreResult(namespace, podName, nodeName, pluginName string, score int64)
	AddPostFilterResult(namespace, podName, nominatedNodeName, pluginName string, nodeNames []string)
	AddPermitResult(namespace, podName, pluginName, status string, timeout time.Duration)
	AddReserveResult(namespace, podName, pluginName, status string)
	AddSelectedNode(namespace, podName, nodeName string)
	AddBindResult(namespace, podName, pluginName, status string)
	AddPreBindResult(namespace, podName, pluginName, status string)
	// AddCustomResult is intended to be used from outside of simulator.
	AddCustomResult(namespace, podName, annotationKey, result string)
}

Directories

Path Synopsis
Package plugin is a generated GoMock package.
Package plugin is a generated GoMock package.

Jump to

Keyboard shortcuts

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