predicatechecker

package
v0.0.0-...-fdc6b19 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelegatingSchedulerSharedLister

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

DelegatingSchedulerSharedLister is an implementation of scheduler.SharedLister which passes logic to delegate. Delegate can be updated.

func NewDelegatingSchedulerSharedLister

func NewDelegatingSchedulerSharedLister() *DelegatingSchedulerSharedLister

NewDelegatingSchedulerSharedLister creates new NewDelegatingSchedulerSharedLister

func (*DelegatingSchedulerSharedLister) NodeInfos

NodeInfos returns a NodeInfoLister.

func (*DelegatingSchedulerSharedLister) ResetDelegate

func (lister *DelegatingSchedulerSharedLister) ResetDelegate()

ResetDelegate resets delegate to

func (*DelegatingSchedulerSharedLister) StorageInfos

StorageInfos returns a StorageInfoLister

func (*DelegatingSchedulerSharedLister) UpdateDelegate

func (lister *DelegatingSchedulerSharedLister) UpdateDelegate(delegate schedulerframework.SharedLister)

UpdateDelegate updates the delegate

type PredicateChecker

type PredicateChecker interface {
	FitsAnyNode(clusterSnapshot clustersnapshot.ClusterSnapshot, pod *apiv1.Pod) (string, error)
	FitsAnyNodeMatching(clusterSnapshot clustersnapshot.ClusterSnapshot, pod *apiv1.Pod, nodeMatches func(*schedulerframework.NodeInfo) bool) (string, error)
	CheckPredicates(clusterSnapshot clustersnapshot.ClusterSnapshot, pod *apiv1.Pod, nodeName string) *PredicateError
}

PredicateChecker checks whether all required predicates pass for given Pod and Node.

func NewTestPredicateChecker

func NewTestPredicateChecker(clientset *kubernetes.Clientset) (PredicateChecker, error)

NewTestPredicateChecker builds test version of PredicateChecker.

type PredicateError

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

PredicateError is a structure representing error returned from predicate checking simulation.

func GenericPredicateError

func GenericPredicateError() *PredicateError

GenericPredicateError return a generic instance of PredicateError to be used in context where predicate name is not know.

func NewPredicateError

func NewPredicateError(
	errorType PredicateErrorType,
	predicateName string,
	errorMessage string,
	reasons []string,
	debugInfo func() string,
) *PredicateError

NewPredicateError creates a new predicate error from error and reasons.

func (*PredicateError) ErrorType

func (pe *PredicateError) ErrorType() PredicateErrorType

ErrorType returns if error was internal of names predicate failure.

func (*PredicateError) Message

func (pe *PredicateError) Message() string

Message returns error message.

func (*PredicateError) PredicateName

func (pe *PredicateError) PredicateName() string

PredicateName return name of predicate which failed.

func (*PredicateError) Reasons

func (pe *PredicateError) Reasons() []string

Reasons returns failure reasons from failed predicate as a slice of strings.

func (*PredicateError) VerboseMessage

func (pe *PredicateError) VerboseMessage() string

VerboseMessage generates verbose error message. Building verbose message may be expensive so number of calls should be limited.

type PredicateErrorType

type PredicateErrorType int

PredicateErrorType is type of predicate error

const (
	// NotSchedulablePredicateError means that one of the filters returned that pod does not fit a node
	NotSchedulablePredicateError PredicateErrorType = iota
	// InternalPredicateError denotes internal unexpected error while calling PredicateChecker
	InternalPredicateError
)

type SchedulerBasedPredicateChecker

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

SchedulerBasedPredicateChecker checks whether all required predicates pass for given Pod and Node. The verification is done by calling out to scheduler code.

func NewSchedulerBasedPredicateChecker

func NewSchedulerBasedPredicateChecker(informerFactory informers.SharedInformerFactory, schedConfig *config.KubeSchedulerConfiguration) (*SchedulerBasedPredicateChecker, error)

NewSchedulerBasedPredicateChecker builds scheduler based PredicateChecker.

func (*SchedulerBasedPredicateChecker) CheckPredicates

func (p *SchedulerBasedPredicateChecker) CheckPredicates(clusterSnapshot clustersnapshot.ClusterSnapshot, pod *apiv1.Pod, nodeName string) *PredicateError

CheckPredicates checks if the given pod can be placed on the given node.

func (*SchedulerBasedPredicateChecker) FitsAnyNode

func (p *SchedulerBasedPredicateChecker) FitsAnyNode(clusterSnapshot clustersnapshot.ClusterSnapshot, pod *apiv1.Pod) (string, error)

FitsAnyNode checks if the given pod can be placed on any of the given nodes.

func (*SchedulerBasedPredicateChecker) FitsAnyNodeMatching

func (p *SchedulerBasedPredicateChecker) FitsAnyNodeMatching(clusterSnapshot clustersnapshot.ClusterSnapshot, pod *apiv1.Pod, nodeMatches func(*schedulerframework.NodeInfo) bool) (string, error)

FitsAnyNodeMatching checks if the given pod can be placed on any of the given nodes matching the provided function.

Jump to

Keyboard shortcuts

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