framework

package
v1.30.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const ErrReasonFake = "Nodes failed the fake plugin"

ErrReasonFake is a fake error message denotes the filter function errored.

Variables

This section is empty.

Functions

func BuildNodeInfos added in v1.30.0

func BuildNodeInfos(nodes []*v1.Node) []*framework.NodeInfo

BuildNodeInfos build NodeInfo slice from a v1.Node slice

func ErrorPredicateExtender

func ErrorPredicateExtender(pod *v1.Pod, node *framework.NodeInfo) *framework.Status

ErrorPredicateExtender implements FitPredicate function to always return error status.

func ErrorPrioritizerExtender

func ErrorPrioritizerExtender(pod *v1.Pod, nodes []*framework.NodeInfo) (*framework.NodeScoreList, error)

ErrorPrioritizerExtender implements PriorityFunc function to always return error.

func FalsePredicateExtender

func FalsePredicateExtender(pod *v1.Pod, node *framework.NodeInfo) *framework.Status

FalsePredicateExtender implements FitPredicate function to always return unschedulable status.

func NewEqualPrioritizerPlugin added in v1.30.0

func NewEqualPrioritizerPlugin() frameworkruntime.PluginFactory

NewEqualPrioritizerPlugin returns a factory function to build equalPrioritizerPlugin.

func NewFakeFilterPlugin

func NewFakeFilterPlugin(failedNodeReturnCodeMap map[string]framework.Code) frameworkruntime.PluginFactory

NewFakeFilterPlugin initializes a fakeFilterPlugin and returns it.

func NewFakePermitPlugin

func NewFakePermitPlugin(status *framework.Status, timeout time.Duration) frameworkruntime.PluginFactory

NewFakePermitPlugin initializes a fakePermitPlugin and returns it.

func NewFakePreBindPlugin

func NewFakePreBindPlugin(status *framework.Status) frameworkruntime.PluginFactory

NewFakePreBindPlugin initializes a fakePreBindPlugin and returns it.

func NewFakePreFilterPlugin

func NewFakePreFilterPlugin(name string, result *framework.PreFilterResult, status *framework.Status) frameworkruntime.PluginFactory

NewFakePreFilterPlugin initializes a fakePreFilterPlugin and returns it.

func NewFakePreScoreAndScorePlugin

func NewFakePreScoreAndScorePlugin(name string, score int64, preScoreStatus, scoreStatus *framework.Status) frameworkruntime.PluginFactory

func NewFakeReservePlugin

func NewFakeReservePlugin(status *framework.Status) frameworkruntime.PluginFactory

NewFakeReservePlugin initializes a fakeReservePlugin and returns it.

func NewFalseFilterPlugin

func NewFalseFilterPlugin(_ context.Context, _ runtime.Object, _ framework.Handle) (framework.Plugin, error)

NewFalseFilterPlugin initializes a FalseFilterPlugin and returns it.

func NewFramework

func NewFramework(ctx context.Context, fns []RegisterPluginFunc, profileName string, opts ...runtime.Option) (framework.Framework, error)

NewFramework creates a Framework from the register functions and options.

func NewMatchFilterPlugin

func NewMatchFilterPlugin(_ context.Context, _ runtime.Object, _ framework.Handle) (framework.Plugin, error)

NewMatchFilterPlugin initializes a MatchFilterPlugin and returns it.

func NewNode2PrioritizerPlugin

func NewNode2PrioritizerPlugin() frameworkruntime.PluginFactory

NewNode2PrioritizerPlugin returns a factory function to build node2PrioritizerPlugin.

func NewTrueFilterPlugin

func NewTrueFilterPlugin(_ context.Context, _ runtime.Object, _ framework.Handle) (framework.Plugin, error)

NewTrueFilterPlugin initializes a TrueFilterPlugin and returns it.

func Node1PredicateExtender

func Node1PredicateExtender(pod *v1.Pod, node *framework.NodeInfo) *framework.Status

Node1PredicateExtender implements FitPredicate function to return true when the given node's name is "node1"; otherwise return false.

func Node1PrioritizerExtender

func Node1PrioritizerExtender(pod *v1.Pod, nodes []*framework.NodeInfo) (*framework.NodeScoreList, error)

Node1PrioritizerExtender implements PriorityFunc function to give score 10 if the given node's name is "node1"; otherwise score 1.

func Node2PredicateExtender

func Node2PredicateExtender(pod *v1.Pod, node *framework.NodeInfo) *framework.Status

Node2PredicateExtender implements FitPredicate function to return true when the given node's name is "node2"; otherwise return false.

func Node2PrioritizerExtender

func Node2PrioritizerExtender(pod *v1.Pod, nodes []*framework.NodeInfo) (*framework.NodeScoreList, error)

Node2PrioritizerExtender implements PriorityFunc function to give score 10 if the given node's name is "node2"; otherwise score 1.

func TruePredicateExtender

func TruePredicateExtender(pod *v1.Pod, node *framework.NodeInfo) *framework.Status

TruePredicateExtender implements FitPredicate function to always return success status.

Types

type CSINodeLister

type CSINodeLister []storagev1.CSINode

CSINodeLister declares a storagev1.CSINode type for testing.

func (CSINodeLister) Get

func (n CSINodeLister) Get(name string) (*storagev1.CSINode, error)

Get returns a fake CSINode object.

func (CSINodeLister) List

func (n CSINodeLister) List(selector labels.Selector) (ret []*storagev1.CSINode, err error)

List lists all CSINodes in the indexer.

type ControllerLister

type ControllerLister []*v1.ReplicationController

ControllerLister implements ControllerLister on []v1.ReplicationController for test purposes.

func (ControllerLister) GetPodControllers

func (f ControllerLister) GetPodControllers(pod *v1.Pod) (controllers []*v1.ReplicationController, err error)

GetPodControllers gets the ReplicationControllers that have the selector that match the labels on the given pod

func (ControllerLister) List

List returns []v1.ReplicationController, the list of all ReplicationControllers.

func (ControllerLister) ReplicationControllers

func (f ControllerLister) ReplicationControllers(namespace string) corelisters.ReplicationControllerNamespaceLister

ReplicationControllers returns nil

type FakeExtender

type FakeExtender struct {
	// ExtenderName indicates this fake extender's name.
	// Note that extender name should be unique.
	ExtenderName     string
	Predicates       []FitPredicate
	Prioritizers     []PriorityConfig
	Weight           int64
	NodeCacheCapable bool
	FilteredNodes    []*framework.NodeInfo
	UnInterested     bool
	Ignorable        bool
	Binder           func() error

	// Cached node information for fake extender
	CachedNodeNameToInfo map[string]*framework.NodeInfo
}

FakeExtender is a data struct which implements the Extender interface.

func (*FakeExtender) Bind

func (f *FakeExtender) Bind(binding *v1.Binding) error

Bind implements the extender Bind function.

func (*FakeExtender) Filter

Filter implements the extender Filter function.

func (*FakeExtender) IsBinder

func (f *FakeExtender) IsBinder() bool

IsBinder returns true indicating the extender implements the Binder function.

func (*FakeExtender) IsFilter added in v1.30.0

func (f *FakeExtender) IsFilter() bool

IsFilter returns true if there are any filters.

func (*FakeExtender) IsIgnorable

func (f *FakeExtender) IsIgnorable() bool

IsIgnorable returns a bool value indicating whether internal errors can be ignored.

func (*FakeExtender) IsInterested

func (f *FakeExtender) IsInterested(pod *v1.Pod) bool

IsInterested returns a bool indicating whether this extender is interested in this Pod.

func (*FakeExtender) IsPrioritizer added in v1.30.0

func (f *FakeExtender) IsPrioritizer() bool

IsPrioritizer returns true if there are any prioritizers.

func (*FakeExtender) Name

func (f *FakeExtender) Name() string

Name returns name of the extender.

func (*FakeExtender) Prioritize

func (f *FakeExtender) Prioritize(pod *v1.Pod, nodes []*framework.NodeInfo) (*extenderv1.HostPriorityList, int64, error)

Prioritize implements the extender Prioritize function.

func (*FakeExtender) ProcessPreemption

func (f *FakeExtender) ProcessPreemption(
	pod *v1.Pod,
	nodeNameToVictims map[string]*extenderv1.Victims,
	nodeInfos framework.NodeInfoLister,
) (map[string]*extenderv1.Victims, error)

ProcessPreemption implements the extender preempt function.

func (*FakeExtender) SupportsPreemption

func (f *FakeExtender) SupportsPreemption() bool

SupportsPreemption returns true indicating the extender supports preemption.

type FakeFilterPlugin

type FakeFilterPlugin struct {
	NumFilterCalled         int32
	FailedNodeReturnCodeMap map[string]framework.Code
}

FakeFilterPlugin is a test filter plugin to record how many times its Filter() function have been called, and it returns different 'Code' depending on its internal 'failedNodeReturnCodeMap'.

func (*FakeFilterPlugin) Filter

Filter invoked at the filter extension point.

func (*FakeFilterPlugin) Name

func (pl *FakeFilterPlugin) Name() string

Name returns name of the plugin.

type FakePermitPlugin

type FakePermitPlugin struct {
	Status  *framework.Status
	Timeout time.Duration
}

FakePermitPlugin is a test permit plugin.

func (*FakePermitPlugin) Name

func (pl *FakePermitPlugin) Name() string

Name returns name of the plugin.

func (*FakePermitPlugin) Permit

Permit invoked at the Permit extension point.

type FakePreBindPlugin

type FakePreBindPlugin struct {
	Status *framework.Status
}

FakePreBindPlugin is a test prebind plugin.

func (*FakePreBindPlugin) Name

func (pl *FakePreBindPlugin) Name() string

Name returns name of the plugin.

func (*FakePreBindPlugin) PreBind

PreBind invoked at the PreBind extension point.

type FakePreFilterAndFilterPlugin

type FakePreFilterAndFilterPlugin struct {
	*FakePreFilterPlugin
	*FakeFilterPlugin
}

func (FakePreFilterAndFilterPlugin) Name

Name returns name of the plugin.

type FakePreFilterPlugin

type FakePreFilterPlugin struct {
	Result *framework.PreFilterResult
	Status *framework.Status
	// contains filtered or unexported fields
}

FakePreFilterPlugin is a test filter plugin.

func (*FakePreFilterPlugin) Name

func (pl *FakePreFilterPlugin) Name() string

Name returns name of the plugin.

func (*FakePreFilterPlugin) PreFilter

PreFilter invoked at the PreFilter extension point.

func (*FakePreFilterPlugin) PreFilterExtensions

func (pl *FakePreFilterPlugin) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions no extensions implemented by this plugin.

type FakePreScoreAndScorePlugin

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

func (*FakePreScoreAndScorePlugin) Name

Name returns name of the plugin.

func (*FakePreScoreAndScorePlugin) PreScore

func (*FakePreScoreAndScorePlugin) Score

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

func (*FakePreScoreAndScorePlugin) ScoreExtensions

type FakeReservePlugin

type FakeReservePlugin struct {
	Status *framework.Status
}

FakeReservePlugin is a test reserve plugin.

func (*FakeReservePlugin) Name

func (pl *FakeReservePlugin) Name() string

Name returns name of the plugin.

func (*FakeReservePlugin) Reserve

Reserve invoked at the Reserve extension point.

func (*FakeReservePlugin) Unreserve

func (pl *FakeReservePlugin) Unreserve(_ context.Context, _ *framework.CycleState, _ *v1.Pod, _ string)

Unreserve invoked at the Unreserve extension point.

type FalseFilterPlugin

type FalseFilterPlugin struct{}

FalseFilterPlugin is a filter plugin which always return Unschedulable when Filter function is called.

func (*FalseFilterPlugin) Filter

Filter invoked at the filter extension point.

func (*FalseFilterPlugin) Name

func (pl *FalseFilterPlugin) Name() string

Name returns name of the plugin.

type FitPredicate

type FitPredicate func(pod *v1.Pod, node *framework.NodeInfo) *framework.Status

FitPredicate is a function type which is used in fake extender.

type MatchFilterPlugin

type MatchFilterPlugin struct{}

MatchFilterPlugin is a filter plugin which return Success when the evaluated pod and node have the same name; otherwise return Unschedulable.

func (*MatchFilterPlugin) Filter

Filter invoked at the filter extension point.

func (*MatchFilterPlugin) Name

func (pl *MatchFilterPlugin) Name() string

Name returns name of the plugin.

type NodeInfoLister

type NodeInfoLister []*framework.NodeInfo

NodeInfoLister declares a framework.NodeInfo type for testing.

func (NodeInfoLister) Get

func (nodes NodeInfoLister) Get(nodeName string) (*framework.NodeInfo, error)

Get returns a fake node object in the fake nodes.

func (NodeInfoLister) HavePodsWithAffinityList

func (nodes NodeInfoLister) HavePodsWithAffinityList() ([]*framework.NodeInfo, error)

HavePodsWithAffinityList is supposed to list nodes with at least one pod with affinity. For the fake lister we just return everything.

func (NodeInfoLister) HavePodsWithRequiredAntiAffinityList

func (nodes NodeInfoLister) HavePodsWithRequiredAntiAffinityList() ([]*framework.NodeInfo, error)

HavePodsWithRequiredAntiAffinityList is supposed to list nodes with at least one pod with required anti-affinity. For the fake lister we just return everything.

func (NodeInfoLister) List

func (nodes NodeInfoLister) List() ([]*framework.NodeInfo, error)

List lists all nodes.

type PersistentVolumeClaimLister

type PersistentVolumeClaimLister []v1.PersistentVolumeClaim

PersistentVolumeClaimLister declares a []v1.PersistentVolumeClaim type for testing.

func (PersistentVolumeClaimLister) List

func (pvcs PersistentVolumeClaimLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error)

List gets PVC matching the namespace and PVC ID.

func (PersistentVolumeClaimLister) PersistentVolumeClaims

PersistentVolumeClaims returns a fake PersistentVolumeClaimLister object.

type PersistentVolumeLister

type PersistentVolumeLister []v1.PersistentVolume

PersistentVolumeLister declares a []v1.PersistentVolume type for testing.

func (PersistentVolumeLister) Get

Get returns a fake PV object in the fake PVs by PV ID.

func (PersistentVolumeLister) List

List lists all PersistentVolumes in the indexer.

type PriorityConfig

type PriorityConfig struct {
	Function PriorityFunc
	Weight   int64
}

PriorityConfig is used in fake extender to perform Prioritize function.

type PriorityFunc

type PriorityFunc func(pod *v1.Pod, nodes []*framework.NodeInfo) (*framework.NodeScoreList, error)

PriorityFunc is a function type which is used in fake extender.

type RegisterPluginFunc

type RegisterPluginFunc func(reg *runtime.Registry, profile *schedulerapi.KubeSchedulerProfile)

RegisterPluginFunc is a function signature used in method RegisterFilterPlugin() to register a Filter Plugin to a given registry.

func RegisterBindPlugin

func RegisterBindPlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterBindPlugin returns a function to register a Bind Plugin to a given registry.

func RegisterFilterPlugin

func RegisterFilterPlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterFilterPlugin returns a function to register a Filter Plugin to a given registry.

func RegisterPermitPlugin

func RegisterPermitPlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterPermitPlugin returns a function to register a Permit Plugin to a given registry.

func RegisterPluginAsExtensions

func RegisterPluginAsExtensions(pluginName string, pluginNewFunc runtime.PluginFactory, extensions ...string) RegisterPluginFunc

RegisterPluginAsExtensions returns a function to register a Plugin as given extensionPoints to a given registry.

func RegisterPluginAsExtensionsWithWeight

func RegisterPluginAsExtensionsWithWeight(pluginName string, weight int32, pluginNewFunc runtime.PluginFactory, extensions ...string) RegisterPluginFunc

RegisterPluginAsExtensionsWithWeight returns a function to register a Plugin as given extensionPoints with weight to a given registry.

func RegisterPreBindPlugin

func RegisterPreBindPlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterPreBindPlugin returns a function to register a PreBind Plugin to a given registry.

func RegisterPreFilterPlugin

func RegisterPreFilterPlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterPreFilterPlugin returns a function to register a PreFilter Plugin to a given registry.

func RegisterPreScorePlugin

func RegisterPreScorePlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterPreScorePlugin returns a function to register a Score Plugin to a given registry.

func RegisterQueueSortPlugin

func RegisterQueueSortPlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterQueueSortPlugin returns a function to register a QueueSort Plugin to a given registry.

func RegisterReservePlugin

func RegisterReservePlugin(pluginName string, pluginNewFunc runtime.PluginFactory) RegisterPluginFunc

RegisterReservePlugin returns a function to register a Reserve Plugin to a given registry.

func RegisterScorePlugin

func RegisterScorePlugin(pluginName string, pluginNewFunc runtime.PluginFactory, weight int32) RegisterPluginFunc

RegisterScorePlugin returns a function to register a Score Plugin to a given registry.

type ReplicaSetLister

type ReplicaSetLister []*appsv1.ReplicaSet

ReplicaSetLister implements ControllerLister on []extensions.ReplicaSet for test purposes.

func (ReplicaSetLister) GetPodReplicaSets

func (f ReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) (rss []*appsv1.ReplicaSet, err error)

GetPodReplicaSets gets the ReplicaSets that have the selector that match the labels on the given pod

func (ReplicaSetLister) List

List returns replica sets.

func (ReplicaSetLister) ReplicaSets

ReplicaSets returns nil

type ServiceLister

type ServiceLister []*v1.Service

ServiceLister implements ServiceLister on []v1.Service for test purposes.

func (ServiceLister) List

func (f ServiceLister) List(labels.Selector) ([]*v1.Service, error)

List returns v1.ServiceList, the list of all services.

func (ServiceLister) Services

Services returns nil.

type StatefulSetLister

type StatefulSetLister []*appsv1.StatefulSet

StatefulSetLister implements ControllerLister on []appsv1.StatefulSet for testing purposes.

func (StatefulSetLister) GetPodStatefulSets

func (f StatefulSetLister) GetPodStatefulSets(pod *v1.Pod) (sss []*appsv1.StatefulSet, err error)

GetPodStatefulSets gets the StatefulSets that have the selector that match the labels on the given pod.

func (StatefulSetLister) List

List returns stateful sets.

func (StatefulSetLister) StatefulSets

StatefulSets returns nil

type StorageClassLister

type StorageClassLister []storagev1.StorageClass

StorageClassLister declares a []storagev1.StorageClass type for testing.

func (StorageClassLister) Get

func (classes StorageClassLister) Get(name string) (*storagev1.StorageClass, error)

Get returns a fake storage class object in the fake storage classes by name.

func (StorageClassLister) List

func (classes StorageClassLister) List(selector labels.Selector) ([]*storagev1.StorageClass, error)

List lists all StorageClass in the indexer.

type TrueFilterPlugin

type TrueFilterPlugin struct{}

TrueFilterPlugin is a filter plugin which always return Success when Filter function is called.

func (*TrueFilterPlugin) Filter

Filter invoked at the filter extension point.

func (*TrueFilterPlugin) Name

func (pl *TrueFilterPlugin) Name() string

Name returns name of the plugin.

Jump to

Keyboard shortcuts

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