api

package
v0.0.0-...-dcfb068 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// State data key
	NodePartitionTypeStateKey = "NodePartitionType"
	PodLauncherStateKey       = "PodLauncher"
	PodResourceTypeStateKey   = "PodResourceType"
	PodTraceStateKey          = "PodTrace"
	NodeGroupStateKey         = "NodeGroup"
	PotentialVictimsKey       = "PotentialVictims"
	PDBsAllowedKey            = "PDBsAllowed"
	PDBItemsKey               = "PDBItems"
	PodsCanNotBePreemptedKey  = "PodsCanNotBePreempted"
	MatchedPDBIndexesKey      = "MatchedPDBIndexes"
	VictimCountOfDeployKey    = "VictimCountOfDeployKey"
	IndexOfPDBKey             = "IndexOfPDBKey"

	// Error Message
	NodePartitionTypeMissedErrorString = "failed to get NodePartitionType, supposed to be set in cycle state"
	PodLauncherMissedErrorString       = "failed to get PodLauncher, supposed to be set in cycle state"
	PodResourceTypeMissingErrorString  = "failed to get PodResourceType, supposed to be set in cycle state"
	PodTraceMissingErrorString         = "failed to get PodTrace, supposed to be set in cycle state"
	NodeGroupMissedErrorString         = "failed to get NodeGroup, supposed to be set in cycle state"

	UnsupportedError = "unsupported %s"
	MissedError      = "missed %s"

	PodPropertyKey = "PodProperty"
)
View Source
const (
	// MaxNodeScore is the maximum score a Score plugin is expected to return.
	MaxNodeScore int64 = 100

	// MinNodeScore is the minimum score a Score plugin is expected to return.
	MinNodeScore int64 = 0

	// MaxTotalScore is the maximum total score.
	MaxTotalScore int64 = math.MaxInt64
)
View Source
const (
	PreFilterPhase         = "PreFilter"
	FilterPhase            = "Filter"
	PreScorePhase          = "PreScore"
	ScorePhase             = "Score"
	CrossNodesCheckerPhase = "CrossNodesChecker"

	ClusterPrePreemptingPhase = "ClusterPrePreempting"
	NodePrePreemptingPhase    = "NodePrePreempting"
	VictimSearchingPhase      = "VictimSearching"
	PostVictimSearchingPhase  = "PostVictimSearching"
	NodePostPreemptingPhase   = "NodePostPreempting"

	CheckTopologyPhase = "CheckTopology"
	CheckConflictPhase = "CheckConflict"
	PermitPhase        = "Permit"
	PreBindPhase       = "PreBind"
	PostBindPhase      = "PostBind"
	BindPhase          = "Bind"
	ReservePhase       = "Reserve"
)

These are predefined phases used in Scheduler and Binder.

View Source
const (
	DefaultNodeCircleName string = ""
	DefaultNodeGroupName  string = ""
)
View Source
const (
	MaxSwitchNum int        = 31 // 0 as default, with 30 additional subclusters
	GTBitMask    SwitchType = 1<<MaxSwitchNum - 1
	BEBitMask    SwitchType = GTBitMask << MaxSwitchNum

	DisableScheduleSwitch SwitchType = 0
	SwitchTypeAll         SwitchType = GTBitMask | BEBitMask

	RecycleExpiration = 30 * 24 * time.Hour

	DisableScheduleSwitchStr = "DisableScheduleSwitch"
	GTScheduleStr            = "GTSchedule"
	BEScheduleStr            = "BESchedule"
	InvalidScheduleStr       = "InvalidSchedule"

	DefaultSubClusterIndex      = 0
	DefaultSubClusterSwitchType = (SwitchType(1) << DefaultSubClusterIndex) | (SwitchType(1) << DefaultSubClusterIndex << MaxSwitchNum)
	DefaultSubCluster           = ""
)
View Source
const (
	NamespaceTagKey  = "namespace"
	UnitKeyTagKey    = "unitKey"
	PriorityTagKey   = "priority"
	QosTagKey        = "qos"
	SubClusterTagKey = "subCluster"

	UnitTypeTagKey  = "unitType"
	MinMemberTagKey = "minMember"
)
View Source
const DefaultBindAllHostIP = "0.0.0.0"

DefaultBindAllHostIP defines the default ip address used to bind to all host.

View Source
const DefaultPluginWeight = 1
View Source
const NoNodeAvailableMsg = "0/%v nodes are available to run pod %v: %v.\n"

NoNodeAvailableMsg is used to format message when no nodes available.

View Source
const (
	// NotFound is the not found error message.
	NotFound = "not found"
)

Variables

View Source
var (
	// ErrNoNodesAvailable is used to describe the error that no nodes available to schedule pods.
	ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")
	// ErrNoNodeGroupsAvailable is used to describe the error that no node groups available to schedule units.
	ErrNoNodeGroupsAvailable = fmt.Errorf("no node groups available to schedule units")
	// ErrPreemptFailed is used to describe the error that preempt failed for one pod.
	ErrPreemptFailed = fmt.Errorf("preempt failed")
)
View Source
var PodLauncherMissedError = fmt.Errorf(PodLauncherMissedErrorString)
View Source
var PodResourceTypeMissingError = fmt.Errorf(PodResourceTypeMissingErrorString)
View Source
var PodTraceMissingError = fmt.Errorf(PodTraceMissingErrorString)
View Source
var WildCardEvent = ClusterEvent{Resource: WildCard, ActionType: All}

WildCardEvent semantically matches all resources on all actions.

Functions

func AllocClusterIndex

func AllocClusterIndex(subCluster string) int

func CleanClusterIndex

func CleanClusterIndex()

func ClusterIndexToSwitchType

func ClusterIndexToSwitchType(x int) (SwitchType, SwitchType)

func FreeClusterIndex

func FreeClusterIndex(subCluster string) int

func GenerateReadableKey

func GenerateReadableKey(name string) string

func GetClusterIndex

func GetClusterIndex(subCluster string) int

func GetGlobalSubClusterKey

func GetGlobalSubClusterKey() string

func GetIndexOfPDB

func GetIndexOfPDB(state *CycleState) (map[string]int, error)

func GetMatchedPDBIndexes

func GetMatchedPDBIndexes(state *CycleState) (map[string][]int, error)

func GetNodeGroupKey

func GetNodeGroupKey(state *CycleState) (string, error)

func GetOrCreateClusterIndex

func GetOrCreateClusterIndex(subCluster string) (int, bool)

func GetPDBsAllowed

func GetPDBsAllowed(state *CycleState) ([]int32, error)

func GetPodGroupKey

func GetPodGroupKey(podGroup *schedulingv1a1.PodGroup) (string, error)

GetPodGroupKey returns the string key of a podGroup.

func GetPodKey

func GetPodKey(pod *v1.Pod) (string, error)

GetPodKey returns the string key of a pod.

func GetPodLauncher

func GetPodLauncher(state *CycleState) (podutil.PodLauncher, error)

func GetPodPriority

func GetPodPriority(pod *v1.Pod) int32

func GetPodQos

func GetPodQos(pod *v1.Pod) podutil.PodResourceType

func GetPodResourceType

func GetPodResourceType(state *CycleState) (podutil.PodResourceType, error)

func GetPodSubCluster

func GetPodSubCluster(pod *v1.Pod) string

func GetPodTrace

func GetPodTrace(state *CycleState) (tracing.SchedulingTrace, error)

func GetPodsCanNotBePreempted

func GetPodsCanNotBePreempted(state *CycleState) ([]string, error)

func GetUnitKey

func GetUnitKey(pod *v1.Pod) string

func IsConflictResourcesForDifferentQoS

func IsConflictResourcesForDifferentQoS(resourceName v1.ResourceName) bool

func MustConvertToMetricsLabels

func MustConvertToMetricsLabels(property UnitProperty) metrics.Labels

func QuantityEqual

func QuantityEqual(r1, r2 *resource.Quantity) bool

func SetGlobalSubClusterKey

func SetGlobalSubClusterKey(key string)

SetGlobalSubClusterKey will be called only when init scheduler.

func SetIndexOfPDB

func SetIndexOfPDB(pdbNameToIndexes map[string]int, state *CycleState)

func SetMatchedPDBIndexes

func SetMatchedPDBIndexes(victimKey string, indexes []int, state *CycleState) error

func SetNodeGroupKeyState

func SetNodeGroupKeyState(nodeGroup string, state *CycleState) error

func SetPDBItems

func SetPDBItems(pdbItems []PDBItem, state *CycleState) error

func SetPDBsAllowed

func SetPDBsAllowed(pdbsAllowed []int32, state *CycleState) error

func SetPodLauncherState

func SetPodLauncherState(podLauncher podutil.PodLauncher, state *CycleState) error

func SetPodProperty

func SetPodProperty(p *PodProperty, state *CycleState)

SetPodProperty adds a unit property to the state.

func SetPodResourceTypeState

func SetPodResourceTypeState(resourceType podutil.PodResourceType, state *CycleState) error

func SetPodTrace

func SetPodTrace(podTrace tracing.SchedulingTrace, state *CycleState) error

func SetPodsCanNotBePreempted

func SetPodsCanNotBePreempted(podKey string, state *CycleState) error

func TransferGenerationStore

func TransferGenerationStore(cache, snapshot generationstore.Store) (generationstore.ListStore, generationstore.RawStore)

func UnitRequireJobLevelAffinity

func UnitRequireJobLevelAffinity(unit ScheduleUnit) bool

Types

type ActionType

type ActionType int64

ActionType is an integer to represent one type of resource change. Different ActionTypes can be bit-wised to compose new semantics.

const (
	Add    ActionType = 1 << iota // 1
	Delete                        // 10
	// UpdateNodeXYZ is only applicable for Node events.
	UpdateNodeAllocatable // 100
	UpdateNodeLabel       // 1000
	UpdateNodeTaint       // 10000
	UpdateNodeCondition   // 100000

	All ActionType = 1<<iota - 1 // 111111

	// Use the general Update type if you don't either know or care the specific sub-Update type to use.
	Update = UpdateNodeAllocatable | UpdateNodeLabel | UpdateNodeTaint | UpdateNodeCondition
)

Constants for ActionTypes.

type AffinityTerm

type AffinityTerm struct {
	Namespaces  sets.String
	Selector    labels.Selector
	TopologyKey string
}

AffinityTerm is a processed version of v1.PodAffinityTerm.

type BindPlugin

type BindPlugin interface {
	Plugin
	// Bind plugins will not be called until all pre-bind plugins have completed. Each
	// bind plugin is called in the configured order. A bind plugin may choose whether
	// to handle the given Pod. If a bind plugin chooses to handle a Pod, the
	// remaining bind plugins are skipped. When a bind plugin does not handle a pod,
	// it must return Skip in its Status code. If a bind plugin returns an Error, the
	// pod is rejected and will not be bound.
	Bind(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string) *Status
}

BindPlugin is an interface that must be implemented by "Bind" plugins. Bind plugins are used to bind a pod to a Node.

type BinderFramework

type BinderFramework interface {
	RunCheckTopologyPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo NodeInfo) PluginToStatus

	// RunCheckConflictsPlugins runs the set of configured CheckConflicts plugins for pod on
	// the given node. Note that for the node being evaluated, the passed nodeInfo
	// reference could be different from the one in NodeInfoSnapshot map (e.g., pods
	// considered to be running on the node could be different). For example, during
	// preemption, we may pass a copy of the original nodeInfo object that has some pods
	// removed from it to evaluate the possibility of preempting them to
	// schedule the target pod.
	RunCheckConflictsPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo NodeInfo) PluginToStatus

	// RunPreBindPlugins runs the set of configured PreBind plugins. It returns
	// *Status and its code is set to non-success if any of the plugins returns
	// anything but Success. If the Status code is "Unschedulable", it is
	// considered as a scheduling check failure, otherwise, it is considered as an
	// internal error. In either case the pod is not going to be bound.
	RunPreBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) *Status

	// RunPostBindPlugins runs the set of configured PostBind plugins.
	RunPostBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string)

	// RunBindPlugins runs the set of configured Bind plugins. A Bind plugin may choose
	// whether to handle the given Pod. If a Bind plugin chooses to skip the
	// binding, it should return code=5("skip") status. Otherwise, it should return "Error"
	// or "Success". If none of the plugins handled binding, RunBindPlugins returns
	// code=5("skip") status.
	RunBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) *Status

	// RunReservePluginsReserve runs the Reserve method of the set of
	// configured Reserve plugins. If any of these calls returns an error, it
	// does not continue running the remaining ones and returns the error. In
	// such case, pod will not be scheduled.
	RunReservePluginsReserve(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) *Status

	// RunReservePluginsUnreserve runs the Unreserve method of the set of
	// configured Reserve plugins.
	RunReservePluginsUnreserve(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string)

	// RunPermitPlugins runs the set of configured Permit plugins. If any of these
	// plugins returns a status other than "Success" or "Wait", it does not continue
	// running the remaining plugins and returns an error. Otherwise, if any of the
	// plugins returns "Wait", then this function will create and add waiting pod
	// to a map of currently waiting pods and return status with "Wait" code.
	// Pod will remain waiting pod for the minimum duration returned by the Permit plugins.
	RunPermitPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) *Status

	// WaitOnPermit will block, if the pod is a waiting pod, until the waiting pod is rejected or allowed.
	WaitOnPermit(ctx context.Context, pod *v1.Pod) *Status

	// HasCheckConflictsPlugins returns true if at least one CheckConflicts plugin is defined.
	HasCheckConflictsPlugins() bool

	// HasCheckTopologyPlugins returns true if at least one CheckTopology plugin is defined.
	HasCheckTopologyPlugins() bool

	HasPlugin(pluginName string) bool

	// ListPlugins returns a map of extension point name to list of configured Plugins.
	ListPlugins() map[string]sets.String

	// InitCycleState returns a new cycle state to be used in scheduling process, storing default common data from pod annotation in CycleState
	// This function is used to reduce unmarshalling operations in plugins for pod annotations.
	InitCycleState(pod *v1.Pod) (*CycleState, error)

	RunClusterPrePreemptingPlugins(preemptor *v1.Pod, state, preemptionState *CycleState) *Status
	RunVictimCheckingPlugins(preemptor, pod *v1.Pod, state, preemptionState *CycleState) *Status
	RunPostVictimCheckingPlugins(preemptor, pod *v1.Pod, state, preemptionState *CycleState) *Status
}

BinderFramework manages the set of plugins in use by the scheduling framework. Configured plugins are called at specified points in a scheduling context.

type BinderFrameworkHandle

type BinderFrameworkHandle interface {
	GetPodGroupPods(podGroupName string) []*v1.Pod
	GetPodGroupInfo(podGroupName string) (*schedulingv1a1.PodGroup, error)

	// ClientSet returns a kubernetes clientSet.
	ClientSet() clientset.Interface
	CRDClientSet() crdclientset.Interface
	SharedInformerFactory() informers.SharedInformerFactory
	CRDSharedInformerFactory() crdinformers.SharedInformerFactory
	GetFrameworkForPod(*v1.Pod) (BinderFramework, error)
	VolumeBinder() scheduling.GodelVolumeBinder
	GetPDBItemList() []PDBItem

	GetNode(string) (NodeInfo, error)
}

BinderFrameworkHandle provides data and some tools that plugins can use. It is passed to the plugin factories at the time of plugin initialization. Plugins must store and use this handle to call framework functions.

type CachePodInfo

type CachePodInfo struct {
	Pod     *v1.Pod
	Victims *Victims
}

type CachePodInfoWrapper

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

func MakeCachePodInfoWrapper

func MakeCachePodInfoWrapper() *CachePodInfoWrapper

func (*CachePodInfoWrapper) Obj

func (*CachePodInfoWrapper) Pod

func (*CachePodInfoWrapper) Victims

func (w *CachePodInfoWrapper) Victims(victims *Victims) *CachePodInfoWrapper

type CachePodState

type CachePodState struct {
	Pod *v1.Pod
	// Used by assumedPod to determinate expiration.
	Deadline *time.Time
	// Used to block cache from expiring assumedPod if binding still runs
	BindingFinished bool
}

type CachedNominatedNodes

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

func NewCachedNominatedNodes

func NewCachedNominatedNodes() *CachedNominatedNodes

func (*CachedNominatedNodes) GetPodCount

func (cnn *CachedNominatedNodes) GetPodCount() int

func (*CachedNominatedNodes) GetUnusedNominatedNodes

func (cnn *CachedNominatedNodes) GetUnusedNominatedNodes() []*Candidate

func (*CachedNominatedNodes) GetUsedNominatedNode

func (cnn *CachedNominatedNodes) GetUsedNominatedNode() *Candidate

func (*CachedNominatedNodes) HasCrossNodeConstraints

func (cnn *CachedNominatedNodes) HasCrossNodeConstraints() *bool

func (*CachedNominatedNodes) IsEmpty

func (cnn *CachedNominatedNodes) IsEmpty() bool

func (*CachedNominatedNodes) RemoveOnePod

func (cnn *CachedNominatedNodes) RemoveOnePod()

func (*CachedNominatedNodes) SetHasCrossNodesConstraints

func (cnn *CachedNominatedNodes) SetHasCrossNodesConstraints(crossNodes bool)

func (*CachedNominatedNodes) SetPodCount

func (cnn *CachedNominatedNodes) SetPodCount(count int)

func (*CachedNominatedNodes) SetUnusedNominatedNodes

func (cnn *CachedNominatedNodes) SetUnusedNominatedNodes(candidates []*Candidate)

func (*CachedNominatedNodes) SetUsedNominatedNode

func (cnn *CachedNominatedNodes) SetUsedNominatedNode(candidate *Candidate)

type Candidate

type Candidate struct {
	Victims *Victims
	Name    string
}

type CandidatesSortingPlugin

type CandidatesSortingPlugin interface {
	Plugin
	Compare(*Candidate, *Candidate) int
}

type CheckConflictsPlugin

type CheckConflictsPlugin interface {
	Plugin
	// CheckConflicts is called by framework in Binder.
	// All CheckConflictsPlugin should return "Success" to declare that
	// the given node fits the pod. If CheckConflicts doesn't return "Success",
	// CheckConflictsPlugin set proper error message.
	// For the node being evaluated, CheckConflicts plugins should look at the passed
	// nodeInfo reference for this particular node's information (e.g., pods
	// considered to be running on the node) instead of looking it up in the
	// NodeInfoSnapshot because we don't guarantee that they will be the same.
	// For example, during preemption, we may pass a copy of the original
	// nodeInfo object that has some pods removed from it to evaluate the
	// possibility of preempting them to schedule the target pod.
	CheckConflicts(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo NodeInfo) *Status
}

CheckConflictsPlugin is an interface for CheckConflicts plugins. These plugins are called at the CheckConflicts extension point by Binder to check whether the node selected by scheduler can run the pod. These plugins should return "Success", "Unschedulable" or "Error" in Status.code. However, Binder accepts other valid codes as well. Anything other than "Success" will lead to exclusion of the given host from running the pod.

type CheckTopologyPlugin

type CheckTopologyPlugin interface {
	Plugin
	CheckTopology(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo NodeInfo) *Status
}

type ClusterEvent

type ClusterEvent struct {
	Resource   GVK
	ActionType ActionType
}

ClusterEvent abstracts how a system resource's state gets changed. Resource represents the standard API resources such as Pod, Node, etc. ActionType denotes the specific change such as Add, Update or Delete.

type ClusterNodeInfoLister

type ClusterNodeInfoLister interface {
	// List Returns the list of NodeInfos.
	List() []NodeInfo
	// HavePodsWithAffinityList Returns the list of NodeInfos of nodes with pods with affinity terms.
	HavePodsWithAffinityList() []NodeInfo
	// HavePodsWithRequiredAntiAffinityList Returns the list of NodeInfos of nodes with pods with required anti-affinity terms.
	HavePodsWithRequiredAntiAffinityList() []NodeInfo
	// Get Returns the NodeInfo of the given node name.
	Get(nodeName string) (NodeInfo, error)
}

ClusterNodeInfoLister interface represents anything that can list/get NodeInfo objects from node name.

type ClusterPrePreemptingPlugin

type ClusterPrePreemptingPlugin interface {
	Plugin
	ClusterPrePreempting(*v1.Pod, *CycleState, *CycleState) *Status
}

type ClusterSharedLister

type ClusterSharedLister interface {
	NodeInfos() ClusterNodeInfoLister
}

ClusterSharedLister groups scheduler-specific listers.

type Code

type Code int

Code is the Status code/type which is returned from plugins.

const (
	// Success means that plugin ran correctly and found pod schedulable.
	// NOTE: A nil status is also considered as "Success".
	Success Code = iota
	// Error is used for internal plugin errors, unexpected input, etc.
	Error
	// Unschedulable is used when a plugin finds a pod unschedulable. The scheduler might attempt to
	// preempt other pods to get this pod scheduled. Use UnschedulableAndUnresolvable to make the
	// scheduler skip preemption.
	// The accompanying status message should explain why the pod is unschedulable.
	Unschedulable
	// UnschedulableAndUnresolvable is used when a (pre-)filter plugin finds a pod unschedulable and
	// preemption would not change anything. Plugins should return Unschedulable if it is possible
	// that the pod can get scheduled with preemption.
	// The accompanying status message should explain why the pod is unschedulable.
	UnschedulableAndUnresolvable
	// Wait is used when a permit plugin finds a pod scheduling should wait.
	Wait
	// Skip is used when a bind plugin chooses to skip binding.
	Skip
	// PreemptionSuccess is used when preemption pass
	PreemptionSucceed
	// PreemptionFail is used when preemption fail
	PreemptionFail
	// PreemptionNotSure is used when preemption result is not clear
	PreemptionNotSure
)

These are predefined codes used in a Status.

func (Code) String

func (c Code) String() string

type CrossNodesPlugin

type CrossNodesPlugin interface {
	Plugin
	HasCrossNodesConstraints(ctx context.Context, p *v1.Pod) bool
}

type CycleState

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

CycleState provides a mechanism for plugins to store and retrieve arbitrary data. StateData stored by one plugin can be read, altered, or deleted by another plugin. For data that will be read and written by plugins, we use sync.Map to avoid race condition. As for data that will only be read by plugins, we use map directly.

func NewCycleState

func NewCycleState() *CycleState

NewCycleState initializes a new CycleState and returns its pointer.

func (*CycleState) Clone

func (c *CycleState) Clone() *CycleState

Clone creates a copy of CycleState and returns its pointer. Clone returns nil if the context being cloned is nil.

func (*CycleState) Delete

func (c *CycleState) Delete(key StateKey)

Delete deletes data with the given key from CycleState. This function is not thread safe. In multithreading code, lock should be acquired first.

func (*CycleState) Read

func (c *CycleState) Read(key StateKey) (StateData, error)

Read retrieves data with the given "key" from CycleState. If the key is not present an error is returned. This function is not thread safe. In multithreading code, lock should be acquired first.

func (*CycleState) SetRecordPluginMetrics

func (c *CycleState) SetRecordPluginMetrics(flag bool)

SetRecordPluginMetrics sets recordPluginMetrics to the given value.

func (*CycleState) ShouldRecordPluginMetrics

func (c *CycleState) ShouldRecordPluginMetrics() bool

ShouldRecordPluginMetrics returns whether PluginExecutionDuration metrics should be recorded.

func (*CycleState) Write

func (c *CycleState) Write(key StateKey, val StateData)

Write stores the given "val" in CycleState with the given "key". This function is not thread safe. In multithreading code, lock should be acquired first.

type FilterPlugin

type FilterPlugin interface {
	Plugin
	// Filter is called by the scheduling framework.
	// All FilterPlugins should return "Success" to declare that
	// the given node fits the pod. If Filter doesn't return "Success",
	// please refer scheduler/algorithm/predicates/error.go
	// to set error message.
	// For the node being evaluated, Filter plugins should look at the passed
	// nodeInfo reference for this particular node's information (e.g., pods
	// considered to be running on the node) instead of looking it up in the
	// NodeInfoSnapshot because we don't guarantee that they will be the same.
	// For example, during preemption, we may pass a copy of the original
	// nodeInfo object that has some pods removed from it to evaluate the
	// possibility of preempting them to schedule the target pod.
	Filter(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo NodeInfo) *Status
}

FilterPlugin is an interface for Filter plugins. These plugins are called at the filter extension point for filtering out hosts that cannot run a pod. This concept used to be called 'predicate' in the original scheduler. These plugins should return "Success", "Unschedulable" or "Error" in Status.code. However, the scheduler accepts other valid codes as well. Anything other than "Success" will lead to exclusion of the given host from running the pod.

type FitError

type FitError struct {
	Pod                   *v1.Pod
	NumAllNodes           int
	FilteredNodesStatuses NodeToStatusMap
}

FitError describes a fit error of a pod.

func (*FitError) Error

func (f *FitError) Error() string

Error returns detailed information of why the pod failed to fit on each node

type GVK

type GVK string

GVK is short for group/version/kind, which can uniquely represent a particular API resource.

const (
	Pod                   GVK = "Pod"
	Node                  GVK = "Node"
	PersistentVolume      GVK = "PersistentVolume"
	PersistentVolumeClaim GVK = "PersistentVolumeClaim"
	Service               GVK = "Service"
	StorageClass          GVK = "storage.k8s.io/StorageClass"
	CSINode               GVK = "storage.k8s.io/CSINode"
	WildCard              GVK = "*"
)

Constants for GVKs.

type GenerationPodGroup

type GenerationPodGroup interface {
	SetPodGroup(*schedulingv1a1.PodGroup)
	GetPodGroup() *schedulingv1a1.PodGroup
	Clone() GenerationPodGroup
	generationstore.StoredObj
}

func NewGenerationPodGroup

func NewGenerationPodGroup(podgroup *schedulingv1a1.PodGroup) GenerationPodGroup

type GenerationPodGroupImpl

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

ATTENTION: GenerationPodGroupImpl.Clone will not deep-copy the PodGroup object. The scheduling process CAN NOT modify the PodGroup object returned to it by Snapshot.

func (GenerationPodGroupImpl) Clone

func (*GenerationPodGroupImpl) GetGeneration

func (i *GenerationPodGroupImpl) GetGeneration() int64

func (*GenerationPodGroupImpl) GetPodGroup

func (*GenerationPodGroupImpl) SetGeneration

func (i *GenerationPodGroupImpl) SetGeneration(generation int64)

func (*GenerationPodGroupImpl) SetPodGroup

func (i *GenerationPodGroupImpl) SetPodGroup(podgroup *schedulingv1a1.PodGroup)

type GenerationStringSet

type GenerationStringSet interface {
	Has(string) bool
	Insert(...string)
	Delete(...string)
	Len() int
	GetGeneration() int64
	SetGeneration(generation int64)
	Equal(GenerationStringSet) bool
	Reset(GenerationStringSet)
	Range(GenerationStringSetRangeFunc)
	Strings() []string
}

func NewGenerationStringSet

func NewGenerationStringSet(strings ...string) GenerationStringSet

type GenerationStringSetImpl

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

func (*GenerationStringSetImpl) Delete

func (s *GenerationStringSetImpl) Delete(strings ...string)

func (*GenerationStringSetImpl) Equal

func (*GenerationStringSetImpl) GetGeneration

func (s *GenerationStringSetImpl) GetGeneration() int64

func (*GenerationStringSetImpl) Has

func (s *GenerationStringSetImpl) Has(string string) bool

func (*GenerationStringSetImpl) Insert

func (s *GenerationStringSetImpl) Insert(strings ...string)

func (*GenerationStringSetImpl) Len

func (s *GenerationStringSetImpl) Len() int

func (*GenerationStringSetImpl) Range

func (*GenerationStringSetImpl) Reset

func (*GenerationStringSetImpl) SetGeneration

func (s *GenerationStringSetImpl) SetGeneration(generation int64)

func (*GenerationStringSetImpl) Strings

func (s *GenerationStringSetImpl) Strings() []string

type GenerationStringSetRangeFunc

type GenerationStringSetRangeFunc func(key string)

type GroupingPlugin

type GroupingPlugin interface {
	Plugin
	Grouping(context.Context, ScheduleUnit, *CycleState, NodeGroup) ([]NodeGroup, *Status)
}

type HostPortInfo

type HostPortInfo map[string]map[ProtocolPort]struct{}

HostPortInfo stores mapping from ip to a set of ProtocolPort

func (HostPortInfo) Add

func (h HostPortInfo) Add(ip, protocol string, port int32)

Add adds (ip, protocol, port) to HostPortInfo

func (HostPortInfo) CheckConflict

func (h HostPortInfo) CheckConflict(ip, protocol string, port int32) bool

CheckConflict checks if the input (ip, protocol, port) conflicts with the existing ones in HostPortInfo.

func (HostPortInfo) Len

func (h HostPortInfo) Len() int

Len returns the total number of (ip, protocol, port) tuple in HostPortInfo

func (HostPortInfo) Remove

func (h HostPortInfo) Remove(ip, protocol string, port int32)

Remove removes (ip, protocol, port) from HostPortInfo

type ImageStateSummary

type ImageStateSummary struct {
	// Size of the image
	Size int64
	// Used to track how many nodes have this image
	NumNodes int
}

ImageStateSummary provides summarized information about the state of an image.

type LessFunc

type LessFunc func(podInfo1, podInfo2 *QueuedPodInfo) bool

LessFunc is the function to sort pod info

type LoadAwareNodeMetricInfo

type LoadAwareNodeMetricInfo struct {
	Name                 string
	UpdateTime           metav1.Time
	ProfileMilliCPUUsage int64
	ProfileMEMUsage      int64
}

type LoadAwareNodeUsage

type LoadAwareNodeUsage struct {
	RequestMilliCPU int64
	RequestMEM      int64
	ProfileMilliCPU int64
	ProfileMEM      int64
}

In order to minimize computational overhead as much as possible, only the CPU/mem fields are used here. In the future, field expansion needs to be carried out based on actual needs

type LocatingPlugin

type LocatingPlugin interface {
	Plugin
	Locating(context.Context, ScheduleUnit, *CycleState, NodeGroup) (NodeGroup, *Status)
}

type MetaPod

type MetaPod struct {
	UID string
}

MetaPod represent identifier for a v1.Pod

type MetaVictims

type MetaVictims struct {
	Pods             []*MetaPod
	NumPDBViolations int64
}

MetaVictims represents:

pods:  a group of pods expected to be preempted.
  Only Pod identifiers will be sent and user are expect to get v1.Pod in their own way.
numPDBViolations: the count of violations of PodDisruptionBudget

type NodeCircle

type NodeCircle interface {
	NodeInfoLister
	GetKey() string
	Validate() error
}

func NewNodeCircle

func NewNodeCircle(key string, lister NodeInfoLister) NodeCircle

type NodeCircleImpl

type NodeCircleImpl struct {
	NodeInfoLister
	// contains filtered or unexported fields
}

func (*NodeCircleImpl) GetKey

func (nc *NodeCircleImpl) GetKey() string

func (*NodeCircleImpl) Validate

func (nc *NodeCircleImpl) Validate() error

type NodeCircleList

type NodeCircleList []NodeCircle

type NodeGroup

type NodeGroup interface {
	GetKey() string
	Validate() error

	GetNodeCircles() NodeCircleList
	SetNodeCircles(NodeCircleList)

	GetPreferredNodes() PreferredNodes
	SetPreferredNodes(PreferredNodes)
}

func FilterNodeGroup

func FilterNodeGroup(nodeGroup NodeGroup, filterFunc func(NodeInfo) bool) NodeGroup

func NewNodeGroup

func NewNodeGroup(key string, nodeCircles []NodeCircle) NodeGroup

type NodeGroupImpl

type NodeGroupImpl struct {
	Key            string
	NodeCircles    []NodeCircle
	PreferredNodes PreferredNodes
}

func (*NodeGroupImpl) GetKey

func (ng *NodeGroupImpl) GetKey() string

func (*NodeGroupImpl) GetNodeCircles

func (ng *NodeGroupImpl) GetNodeCircles() NodeCircleList

func (*NodeGroupImpl) GetPreferredNodes

func (ng *NodeGroupImpl) GetPreferredNodes() PreferredNodes

func (*NodeGroupImpl) SetNodeCircles

func (ng *NodeGroupImpl) SetNodeCircles(nodeCircleList NodeCircleList)

func (*NodeGroupImpl) SetPreferredNodes

func (ng *NodeGroupImpl) SetPreferredNodes(preferredNodes PreferredNodes)

func (*NodeGroupImpl) Validate

func (ng *NodeGroupImpl) Validate() error

type NodeHashSlice

type NodeHashSlice interface {
	Add(NodeInfo) bool
	Del(NodeInfo) bool
	Has(string) bool
	Nodes() []NodeInfo
	Len() int
}

NodeHashSlice maintains a linear NodeInfo's slice. The time complexity of all methods is O(1).

func NewNodeHashSlice

func NewNodeHashSlice() NodeHashSlice

type NodeHashSliceImpl

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

NodeHashSliceImpl holds a mapping of string keys to slice index, and slice to NodeInfo. When adding a NodeInfo, we will place it directly at the end of the slice. When deleting a NodeInfo, we swap it with the last NodeInfo and delete the last NodeInfo.

func (*NodeHashSliceImpl) Add

func (hs *NodeHashSliceImpl) Add(n NodeInfo) bool

func (*NodeHashSliceImpl) Del

func (hs *NodeHashSliceImpl) Del(n NodeInfo) bool

func (*NodeHashSliceImpl) Has

func (hs *NodeHashSliceImpl) Has(key string) bool

func (*NodeHashSliceImpl) Len

func (hs *NodeHashSliceImpl) Len() int

func (*NodeHashSliceImpl) Nodes

func (hs *NodeHashSliceImpl) Nodes() []NodeInfo

type NodeInfo

type NodeInfo interface {
	GetNodeName() string
	GetGeneration() int64
	SetGeneration(generation int64)
	GetNodeLabels(podLauncher podutil.PodLauncher) map[string]string
	GetUsedPorts() HostPortInfo
	SetUsedPorts(HostPortInfo)

	GetGuaranteedRequested() *Resource
	GetGuaranteedNonZeroRequested() *Resource
	GetGuaranteedAllocatable() *Resource
	GetGuaranteedCapacity() *Resource
	GetBestEffortRequested() *Resource
	GetBestEffortNonZeroRequested() *Resource
	GetBestEffortAllocatable() *Resource
	SetGuaranteedRequested(*Resource)
	SetGuaranteedNonZeroRequested(*Resource)
	SetGuaranteedAllocatable(*Resource)
	SetGuaranteedCapacity(*Resource)
	SetBestEffortRequested(*Resource)
	SetBestEffortNonZeroRequested(*Resource)
	SetBestEffortAllocatable(*Resource)

	GetNodeInSchedulerPartition() bool   // TODO
	SetNodeInSchedulerPartition(bool)    // TODO
	GetNMNodeInSchedulerPartition() bool // TODO
	SetNMNodeInSchedulerPartition(bool)  // TODO

	GetImageStates() map[string]*ImageStateSummary
	SetImageStates(map[string]*ImageStateSummary)
	SetTransientInfo(info *TransientSchedulerInfo)
	GetTransientInfo() *TransientSchedulerInfo

	GetNode() *v1.Node
	GetNMNode() *nodev1alpha1.NMNode
	GetCNR() *katalystv1alpha1.CustomNodeResource
	SetNode(node *v1.Node) error
	SetNMNode(nmNode *nodev1alpha1.NMNode) error
	SetCNR(cnr *katalystv1alpha1.CustomNodeResource) error
	RemoveNode()
	RemoveNMNode()
	RemoveCNR()
	ObjectIsNil() bool
	SetNodePartition(inSchedulerPartition bool) error

	Clone() NodeInfo
	String() string

	GetPodsWithAffinity() []*PodInfo
	GetPodsWithRequiredAntiAffinity() []*PodInfo

	AddPod(pod *v1.Pod)
	RemovePod(pod *v1.Pod, preempt bool) error
	GetPods() []*PodInfo
	NumPods() int
	GetVictimCandidates(partitionInfo *PodPartitionInfo) []*PodInfo
	GetOccupiableResources(partitionInfo *PodPartitionInfo) *Resource

	VolumeLimits() map[v1.ResourceName]int64

	GetNumaTopologyStatus() *NumaTopologyStatus
	GetResourcesAvailableForSharedCoresPods(unavailableNumaList []int) *Resource
	GetResourcesRequestsOfSharedCoresPods() *Resource

	GetPrioritiesForPodsMayBePreempted(resourceType podutil.PodResourceType) []int64
}

func NewNodeInfo

func NewNodeInfo(pods ...*v1.Pod) NodeInfo

NewNodeInfo returns a ready to use empty NodeInfo object. If any pods are given in arguments, their information will be aggregated in the returned object.

type NodeInfoImpl

type NodeInfoImpl struct {
	// Overall node information, collected by k8s.
	Node *v1.Node

	// node information, collected by node manager
	NMNode *nodev1alpha1.NMNode

	// cnr stores additional/custom node information, such as numa topology, etc.
	CNR *katalystv1alpha1.CustomNodeResource

	// Whether Node is in the partition of the scheduler
	NodeInSchedulerPartition bool

	// Whether NMNode is in the partition of the scheduler
	NMNodeInSchedulerPartition bool

	// PodInfoMaintainer maintain all the pods running on the node.
	PodInfoMaintainer *PodInfoMaintainer

	// Ports allocated on the node.
	UsedPorts HostPortInfo

	// Total requested resources of all guaranteed pods on this node. This includes
	// assumed pods, which scheduler has sent for binding, but may not be scheduled
	// yet.
	GuaranteedRequested *Resource
	// Total requested resources of all guaranteed pods on this node with a minimum
	// value applied to each container's CPU and memory requests. This does not reflect
	// the actual resource requests for this node, but is used to avoid scheduling
	// many zero-request pods onto one node.
	GuaranteedNonZeroRequested *Resource
	// We store guaranteed allocatedResources (which is the minimum of Node.Status.Allocatable.*
	// and CNR.Status.ResourceAllocatable.*) explicitly
	// as int64, to avoid conversions and accessing map.
	GuaranteedAllocatable *Resource
	// GuaranteedCapacity is capacity resource of node
	GuaranteedCapacity *Resource

	// Total requested resources of all best-effort pods on this node. This includes assumed
	// pods, which scheduler has sent for binding, but may not be scheduled yet.
	BestEffortRequested *Resource
	// Total requested resources of all best-effort pods on this node with a minimum value
	// applied to each container's CPU and memory requests. This does not reflect
	// the actual resource requests for this node, but is used to avoid scheduling
	// many zero-request pods onto one node.
	BestEffortNonZeroRequested *Resource
	// We store best-effort allocatedResources (which is CNR.Status.BestEffortResourceAllocatable.*) explicitly
	// as int64, to avoid conversions and accessing map.
	BestEffortAllocatable *Resource

	// ImageStates holds the entry of an image if and only if this image is on the node. The entry can be used for
	// checking an image's existence and advanced usage (e.g., image locality scheduling policy) based on the image
	// state information.
	ImageStates map[string]*ImageStateSummary

	// TransientInfo holds the information pertaining to a scheduling cycle. This will be destructed at the end of
	// scheduling cycle.
	TransientInfo *TransientSchedulerInfo

	// Whenever NodeInfoImpl changes, generation is bumped.
	// This is used to avoid cloning it if the object didn't change.
	Generation int64

	NumaTopologyStatus *NumaTopologyStatus
	// contains filtered or unexported fields
}

NodeInfoImpl is node level aggregated information.

func (*NodeInfoImpl) AddPod

func (n *NodeInfoImpl) AddPod(pod *v1.Pod)

AddPod adds pod information to this NodeInfoImpl. If resource type is not set or illegal, the pod is considered as a GuaranteedPod, and resource requests are added to guaranteed request

func (*NodeInfoImpl) Clone

func (n *NodeInfoImpl) Clone() NodeInfo

TODO: remove some unused fields Clone returns a copy of this node.

func (*NodeInfoImpl) GetBestEffortAllocatable

func (n *NodeInfoImpl) GetBestEffortAllocatable() *Resource

func (*NodeInfoImpl) GetBestEffortNonZeroRequested

func (n *NodeInfoImpl) GetBestEffortNonZeroRequested() *Resource

func (*NodeInfoImpl) GetBestEffortRequested

func (n *NodeInfoImpl) GetBestEffortRequested() *Resource

func (*NodeInfoImpl) GetCNR

GetCNR returns overall information about this CNR.

func (*NodeInfoImpl) GetGeneration

func (n *NodeInfoImpl) GetGeneration() int64

func (*NodeInfoImpl) GetGuaranteedAllocatable

func (n *NodeInfoImpl) GetGuaranteedAllocatable() *Resource

func (*NodeInfoImpl) GetGuaranteedCapacity

func (n *NodeInfoImpl) GetGuaranteedCapacity() *Resource

func (*NodeInfoImpl) GetGuaranteedNonZeroRequested

func (n *NodeInfoImpl) GetGuaranteedNonZeroRequested() *Resource

func (*NodeInfoImpl) GetGuaranteedRequested

func (n *NodeInfoImpl) GetGuaranteedRequested() *Resource

func (*NodeInfoImpl) GetImageStates

func (n *NodeInfoImpl) GetImageStates() map[string]*ImageStateSummary

func (*NodeInfoImpl) GetNMNode

func (n *NodeInfoImpl) GetNMNode() *nodev1alpha1.NMNode

NMNode returns the NMNode info

func (*NodeInfoImpl) GetNMNodeInSchedulerPartition

func (n *NodeInfoImpl) GetNMNodeInSchedulerPartition() bool

func (*NodeInfoImpl) GetNode

func (n *NodeInfoImpl) GetNode() *v1.Node

Node returns overall information about this node.

func (*NodeInfoImpl) GetNodeInSchedulerPartition

func (n *NodeInfoImpl) GetNodeInSchedulerPartition() bool

func (*NodeInfoImpl) GetNodeLabels

func (n *NodeInfoImpl) GetNodeLabels(podLauncher podutil.PodLauncher) map[string]string

func (*NodeInfoImpl) GetNodeName

func (n *NodeInfoImpl) GetNodeName() string

GetNodeName returns the node name of the node info. Both Node and NMNode should share the same node name.

func (*NodeInfoImpl) GetNumaTopologyStatus

func (n *NodeInfoImpl) GetNumaTopologyStatus() *NumaTopologyStatus

Notice that the return value cannot be modified in the place where the function is called

func (*NodeInfoImpl) GetOccupiableResources

func (n *NodeInfoImpl) GetOccupiableResources(partitionInfo *PodPartitionInfo) *Resource

GetOccupiableResources does a partition on the podinfomaintainer's Splay-Tree based on the PodPartitionInfo and returns the sum of the resources in the partition and the unused resources. All pods in a partition have the possibility of being preempted, which is a rough judgment.

func (*NodeInfoImpl) GetPods

func (n *NodeInfoImpl) GetPods() []*PodInfo

func (*NodeInfoImpl) GetPodsWithAffinity

func (n *NodeInfoImpl) GetPodsWithAffinity() []*PodInfo

func (*NodeInfoImpl) GetPodsWithRequiredAntiAffinity

func (n *NodeInfoImpl) GetPodsWithRequiredAntiAffinity() []*PodInfo

func (*NodeInfoImpl) GetPrioritiesForPodsMayBePreempted

func (n *NodeInfoImpl) GetPrioritiesForPodsMayBePreempted(resourceType podutil.PodResourceType) []int64

func (*NodeInfoImpl) GetResourcesAvailableForSharedCoresPods

func (n *NodeInfoImpl) GetResourcesAvailableForSharedCoresPods(unavailableNumaList []int) *Resource

func (*NodeInfoImpl) GetResourcesRequestsOfSharedCoresPods

func (n *NodeInfoImpl) GetResourcesRequestsOfSharedCoresPods() *Resource

func (*NodeInfoImpl) GetTransientInfo

func (n *NodeInfoImpl) GetTransientInfo() *TransientSchedulerInfo

func (*NodeInfoImpl) GetUsedPorts

func (n *NodeInfoImpl) GetUsedPorts() HostPortInfo

func (*NodeInfoImpl) GetVictimCandidates

func (n *NodeInfoImpl) GetVictimCandidates(partitionInfo *PodPartitionInfo) []*PodInfo

GetVictimCandidates returns all pods under the same PodResourceType that may be preempted. Whether or not they are actually victims depends on the cluster state and the currently preemptor.

func (*NodeInfoImpl) NumPods

func (n *NodeInfoImpl) NumPods() int

func (*NodeInfoImpl) ObjectIsNil

func (n *NodeInfoImpl) ObjectIsNil() bool

func (*NodeInfoImpl) RemoveCNR

func (n *NodeInfoImpl) RemoveCNR()

RemoveCNR removes the CNR object, leaving all other tracking information.

func (*NodeInfoImpl) RemoveNMNode

func (n *NodeInfoImpl) RemoveNMNode()

func (*NodeInfoImpl) RemoveNode

func (n *NodeInfoImpl) RemoveNode()

RemoveNode removes the node object, leaving all other tracking information.

func (*NodeInfoImpl) RemovePod

func (n *NodeInfoImpl) RemovePod(pod *v1.Pod, preempt bool) error

RemovePod subtracts pod information from this NodeInfoImpl. If resource type is not set or illegal, the pod is considered as a GuaranteedPod, and resource requests are removed from guaranteed request

func (*NodeInfoImpl) SetBestEffortAllocatable

func (n *NodeInfoImpl) SetBestEffortAllocatable(r *Resource)

func (*NodeInfoImpl) SetBestEffortNonZeroRequested

func (n *NodeInfoImpl) SetBestEffortNonZeroRequested(r *Resource)

func (*NodeInfoImpl) SetBestEffortRequested

func (n *NodeInfoImpl) SetBestEffortRequested(r *Resource)

func (*NodeInfoImpl) SetCNR

SetCNR sets extend information about node, such as YARN and numa topology, etc.

func (*NodeInfoImpl) SetGeneration

func (n *NodeInfoImpl) SetGeneration(generation int64)

func (*NodeInfoImpl) SetGuaranteedAllocatable

func (n *NodeInfoImpl) SetGuaranteedAllocatable(r *Resource)

func (*NodeInfoImpl) SetGuaranteedCapacity

func (n *NodeInfoImpl) SetGuaranteedCapacity(r *Resource)

func (*NodeInfoImpl) SetGuaranteedNonZeroRequested

func (n *NodeInfoImpl) SetGuaranteedNonZeroRequested(r *Resource)

func (*NodeInfoImpl) SetGuaranteedRequested

func (n *NodeInfoImpl) SetGuaranteedRequested(r *Resource)

func (*NodeInfoImpl) SetImageStates

func (n *NodeInfoImpl) SetImageStates(summary map[string]*ImageStateSummary)

func (*NodeInfoImpl) SetNMNode

func (n *NodeInfoImpl) SetNMNode(nmNode *nodev1alpha1.NMNode) error

SetNMNode sets the overall node information collected by node manager.

func (*NodeInfoImpl) SetNMNodeInSchedulerPartition

func (n *NodeInfoImpl) SetNMNodeInSchedulerPartition(flag bool)

func (*NodeInfoImpl) SetNode

func (n *NodeInfoImpl) SetNode(node *v1.Node) error

SetNode sets the overall node information collected by k8s.

func (*NodeInfoImpl) SetNodeInSchedulerPartition

func (n *NodeInfoImpl) SetNodeInSchedulerPartition(flag bool)

func (*NodeInfoImpl) SetNodePartition

func (n *NodeInfoImpl) SetNodePartition(inSchedulerPartition bool) error

SetNodePartition sets whether the node is in partition of scheduler

func (*NodeInfoImpl) SetTransientInfo

func (n *NodeInfoImpl) SetTransientInfo(info *TransientSchedulerInfo)

func (*NodeInfoImpl) SetUsedPorts

func (n *NodeInfoImpl) SetUsedPorts(info HostPortInfo)

func (*NodeInfoImpl) String

func (n *NodeInfoImpl) String() string

String returns representation of human readable format of this NodeInfoImpl.

func (*NodeInfoImpl) VolumeLimits

func (n *NodeInfoImpl) VolumeLimits() map[v1.ResourceName]int64

VolumeLimits returns volume limits associated with the node

type NodeInfoLister

type NodeInfoLister interface {
	ClusterNodeInfoLister
	// InPartitionList Returns the list of NodeInfos in the partition of the scheduler
	InPartitionList() []NodeInfo
	// OutOfPartitionList Returns the list of NodeInfos out of the partition of the scheduler
	OutOfPartitionList() []NodeInfo
}

NodeInfoLister interface represents anything that can list/get NodeInfo objects from node name.

func FilterNodeInfoLister

func FilterNodeInfoLister(lister NodeInfoLister, filterFunc func(NodeInfo) bool) NodeInfoLister

func NewNodeInfoLister

func NewNodeInfoLister() NodeInfoLister

NewNodeInfoLister creates a new NodeInfoLister object.

type NodeInfoListerImpl

type NodeInfoListerImpl struct {
	// nodeInfoMap is a map of node name to its NodeInfo.
	NodeInfoMap map[string]NodeInfo
	// InPartitionNodes is the list of nodes in the partition of the scheduler.
	InPartitionNodes []NodeInfo
	// OutOfPartitionNodes is the list of nodes out of the partition of the scheduler.
	OutOfPartitionNodes []NodeInfo
	// HavePodsWithAffinityNodes is the list of nodes with at least one pod declaring affinity terms.
	HavePodsWithAffinityNodes []NodeInfo
	// HavePodsWithRequiredAntiAffinityNodes is the list of nodes with at least one pod declaring
	// required anti-affinity terms.
	HavePodsWithRequiredAntiAffinityNodes []NodeInfo
}

NodeInfoListerImpl implements NodeInfoLister interface.

func (*NodeInfoListerImpl) AddNodeInfo

func (i *NodeInfoListerImpl) AddNodeInfo(nodeInfo NodeInfo)

func (*NodeInfoListerImpl) Get

func (i *NodeInfoListerImpl) Get(nodeName string) (NodeInfo, error)

Get returns the NodeInfo of the given node name.

func (*NodeInfoListerImpl) HavePodsWithAffinityList

func (i *NodeInfoListerImpl) HavePodsWithAffinityList() []NodeInfo

HavePodsWithAffinityList returns the list of NodeInfos of nodes with pods with affinity terms.

func (*NodeInfoListerImpl) HavePodsWithRequiredAntiAffinityList

func (i *NodeInfoListerImpl) HavePodsWithRequiredAntiAffinityList() []NodeInfo

HavePodsWithRequiredAntiAffinityList returns the list of NodeInfos of nodes with pods with required anti-affinity terms.

func (*NodeInfoListerImpl) InPartitionList

func (i *NodeInfoListerImpl) InPartitionList() []NodeInfo

func (*NodeInfoListerImpl) List

func (i *NodeInfoListerImpl) List() []NodeInfo

List returns the list of NodeInfos.

func (*NodeInfoListerImpl) OutOfPartitionList

func (i *NodeInfoListerImpl) OutOfPartitionList() []NodeInfo

type NodePostPreemptingPlugin

type NodePostPreemptingPlugin interface {
	Plugin
	NodePostPreempting(*v1.Pod, []*v1.Pod, *CycleState, *CycleState) *Status
}

type NodePrePreemptingPlugin

type NodePrePreemptingPlugin interface {
	Plugin
	NodePrePreempting(*v1.Pod, NodeInfo, *CycleState, *CycleState) *Status
}

type NodeScore

type NodeScore struct {
	Name  string
	Score int64
}

NodeScore is a struct with node name and score.

type NodeScoreList

type NodeScoreList []NodeScore

NodeScoreList declares a list of nodes and their scores.

type NodeToStatusMap

type NodeToStatusMap map[string]*Status

NodeToStatusMap declares map from node name to its status.

func (NodeToStatusMap) Update

func (t NodeToStatusMap) Update(m NodeToStatusMap)

type NodeToStatusMapByTemplate

type NodeToStatusMapByTemplate map[string]NodeToStatusMap

NodeToStatusMapByTemplate declares map from pod template to its NodeToStatusMap.

type NominatedNode

type NominatedNode struct {
	// NodeName is the node where the pod is supposed to place
	NodeName string `json:"node"`
	// VictimPods is the collection of all victim pods name. VictimPods should not be nil or empty.
	// If VictimPods is empty, this pod are supposed to be assumed
	VictimPods VictimPods `json:"victims"`
}

func (*NominatedNode) DeepCopy

func (nn *NominatedNode) DeepCopy() *NominatedNode

func (*NominatedNode) Marshall

func (nn *NominatedNode) Marshall() string

type NumaStatus

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

func NewNumaStatus

func NewNumaStatus(socketID int, monopolized bool, resources map[string]*ResourceStatus) *NumaStatus

func (*NumaStatus) Equal

func (n *NumaStatus) Equal(n2 *NumaStatus) bool

func (*NumaStatus) GetNumaInfo

func (n *NumaStatus) GetNumaInfo() string

GetNumaInfo return the numa's information in string's format

func (*NumaStatus) GetSocket

func (numaStatus *NumaStatus) GetSocket() int

func (*NumaStatus) IsEmptyForConflictResources

func (n *NumaStatus) IsEmptyForConflictResources() bool

type NumaTopologyStatus

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

func (*NumaTopologyStatus) AddPod

func (n *NumaTopologyStatus) AddPod(podInfo *PodInfo)

func (*NumaTopologyStatus) Equal

func (*NumaTopologyStatus) GetFreeNumasInSocketForConflictResources

func (n *NumaTopologyStatus) GetFreeNumasInSocketForConflictResources(socket int) sets.Int

func (*NumaTopologyStatus) GetFreeResourcesInNuma

func (n *NumaTopologyStatus) GetFreeResourcesInNuma(numa int) v1.ResourceList

func (*NumaTopologyStatus) GetFreeResourcesInNumaList

func (n *NumaTopologyStatus) GetFreeResourcesInNumaList(numas []int) v1.ResourceList

func (*NumaTopologyStatus) GetNumaList

func (n *NumaTopologyStatus) GetNumaList() []int

func (*NumaTopologyStatus) GetNumaNum

func (n *NumaTopologyStatus) GetNumaNum() int

func (*NumaTopologyStatus) GetNumaTopology

func (n *NumaTopologyStatus) GetNumaTopology() map[int]*NumaStatus

func (*NumaTopologyStatus) GetResourcesAvailableForSharedCoresPods

func (n *NumaTopologyStatus) GetResourcesAvailableForSharedCoresPods(unavailableNumaList []int) *Resource

func (*NumaTopologyStatus) GetResourcesRequestsOfSharedCoresPods

func (n *NumaTopologyStatus) GetResourcesRequestsOfSharedCoresPods() *Resource

func (*NumaTopologyStatus) GetSocketList

func (n *NumaTopologyStatus) GetSocketList() []int

func (*NumaTopologyStatus) HasResourceInTopology

func (n *NumaTopologyStatus) HasResourceInTopology(rName v1.ResourceName) bool

func (*NumaTopologyStatus) IsNumaEmptyForConflictResources

func (n *NumaTopologyStatus) IsNumaEmptyForConflictResources(numa int) bool

func (*NumaTopologyStatus) RemovePod

func (n *NumaTopologyStatus) RemovePod(podInfo *PodInfo, preempt, notChangedNumaTopology bool)

type ObservableUnit

type ObservableUnit interface {
	GetUnitProperty() UnitProperty
}

type ObserveProperty

type ObserveProperty interface {
	ConvertToMetricsLabels() metrics.Labels
	ConvertToTracingTags() trace.SpanOption
}

ObserveProperty contains object property used by metrics、tracing.

type OrderedPluginRegistry

type OrderedPluginRegistry struct {
	Plugins []string
}

func (*OrderedPluginRegistry) List

func (fpo *OrderedPluginRegistry) List() []string

type OwnerItem

type OwnerItem interface {
	GetOwnerLabels() map[string]string
	AddPDB(string)
	RemovePDB(string)
	GetRelatedPDBs() []string
	SetPDBUpdated()
	GetPDBUpdated() bool
	Replace(OwnerItem)
	Clone() OwnerItem
	GetGeneration() int64
	SetGeneration(int64)
}

type PDBItem

type PDBItem interface {
	GetPDB() *policy.PodDisruptionBudget
	SetPDB(*policy.PodDisruptionBudget)
	GetPDBSelector() labels.Selector
	SetPDBSelector(labels.Selector)
	RemoveAllOwners()
	AddOwner(string, string)
	RemoveOwner(string, string)
	GetRelatedOwnersByType(string) []string
	RemovePDBFromOwner(func(string, string))
	GetGeneration() int64
	SetGeneration(int64)
	Replace(PDBItem)
	Clone() PDBItem
}

func GetPDBItems

func GetPDBItems(state *CycleState) ([]PDBItem, error)

type PermitPlugin

type PermitPlugin interface {
	Plugin
	// TODO: remove the second return value
	// Permit is called before binding a pod (and before binder plugins). Permit
	// plugins are used to prevent or delay the binding of a Pod. A permit plugin
	// must return success or wait with timeout duration, or the pod will be rejected.
	// The pod will also be rejected if the wait timeout or the pod is rejected while
	// waiting. Note that if the plugin returns "wait", the framework will wait only
	// after running the remaining plugins given that no other plugin rejects the pod.
	Permit(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string) (*Status, time.Duration)
}

PermitPlugin is an interface that must be implemented by "Permit" plugins. These plugins are called before a pod is bound to a node.

type Plugin

type Plugin interface {
	Name() string
}

Plugin is the parent type for all the scheduling framework plugins, means the atomic scheduling step, the basic component of constraints

type PluginCollection

type PluginCollection struct {
	// Filters is a set of plugins that should be invoked when filtering out nodes that cannot run the Pod.
	Filters []*PluginSpec

	// Scores is a set of plugins that should be invoked when ranking nodes that have passed the filtering phase.
	Scores []*PluginSpec

	// Searchings is a set of plugins that should be invoked in preemption phase
	Searchings []*VictimSearchingPluginCollectionSpec

	Sortings []*PluginSpec
}

type PluginCollectionSet

type PluginCollectionSet map[string]*PluginCollection

type PluginList

type PluginList interface {
	List() []string
}

type PluginMap

type PluginMap map[string]Plugin

type PluginOrder

type PluginOrder map[string]int

type PluginSpec

type PluginSpec struct {
	Name   string
	Weight int64
}

func NewPluginSpec

func NewPluginSpec(name string) *PluginSpec

func NewPluginSpecWithWeight

func NewPluginSpecWithWeight(name string, weight int64) *PluginSpec

func (*PluginSpec) GetName

func (ps *PluginSpec) GetName() string

func (*PluginSpec) GetWeight

func (ps *PluginSpec) GetWeight() int64

func (*PluginSpec) SetWeight

func (ps *PluginSpec) SetWeight(weight int64)

type PluginToNodeScores

type PluginToNodeScores map[string]NodeScoreList

PluginToNodeScores declares a map from plugin name to its NodeScoreList.

type PluginToStatus

type PluginToStatus map[string]*Status

PluginToStatus maps plugin name to status. Currently used to identify which Filter plugin returned which status.

func (PluginToStatus) Merge

func (p PluginToStatus) Merge() *Status

Merge merges the statuses in the map into one. The resulting status code have the following precedence: Error, UnschedulableAndUnresolvable, Unschedulable.

type Plugins

type Plugins []Plugin

type PluginsRunner

type PluginsRunner interface {
	// RunFilterPlugins runs the set of configured filter plugins for pod on the given node.
	RunFilterPlugins(context.Context, *CycleState, *v1.Pod, NodeInfo) PluginToStatus
	// RunPreFilterExtensionAddPod calls the AddPod interface for the set of configured PreFilter plugins.
	RunPreFilterExtensionAddPod(ctx context.Context, state *CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo NodeInfo) *Status
	// RunPreFilterExtensionRemovePod calls the RemovePod interface for the set of configured PreFilter plugins.
	RunPreFilterExtensionRemovePod(ctx context.Context, state *CycleState, podToSchedule *v1.Pod, podToRemove *v1.Pod, nodeInfo NodeInfo) *Status
}

PluginsRunner abstracts operations to run some plugins. This is used by preemption PostFilter plugins when evaluating the feasibility of scheduling the pod on nodes when certain running pods get evicted.

type PodAllocation

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

func (*PodAllocation) Equal

func (alloc *PodAllocation) Equal(alloc2 *PodAllocation) bool

type PodGroupSchedulingStatus

type PodGroupSchedulingStatus string
const (
	Waiting    PodGroupSchedulingStatus = "Waiting"
	Successful PodGroupSchedulingStatus = "Successful"
	Failed     PodGroupSchedulingStatus = "Failed"
)

These internal status should map to api definition

type PodGroupUnit

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

PodGroupUnit is the podGroup Unit implementation

func NewPodGroupUnit

func NewPodGroupUnit(podGroup *schedulingv1a1.PodGroup, priority int32) *PodGroupUnit

func (*PodGroupUnit) AddPod

func (p *PodGroupUnit) AddPod(pod *QueuedPodInfo) error

func (*PodGroupUnit) AddPods

func (p *PodGroupUnit) AddPods(pods []*QueuedPodInfo) error

func (*PodGroupUnit) AddPodsIfNotPresent

func (p *PodGroupUnit) AddPodsIfNotPresent(pods ...*QueuedPodInfo) error

func (*PodGroupUnit) DeletePod

func (p *PodGroupUnit) DeletePod(pod *QueuedPodInfo) error

func (*PodGroupUnit) GetAffinityNodeSelector

func (p *PodGroupUnit) GetAffinityNodeSelector() (*v1.NodeSelector, error)

func (*PodGroupUnit) GetAnnotations

func (p *PodGroupUnit) GetAnnotations() map[string]string

func (*PodGroupUnit) GetCreationTimestamp

func (p *PodGroupUnit) GetCreationTimestamp() *metav1.Time

func (*PodGroupUnit) GetEnqueuedTimestamp

func (p *PodGroupUnit) GetEnqueuedTimestamp() *metav1.Time

func (*PodGroupUnit) GetKey

func (p *PodGroupUnit) GetKey() string

func (*PodGroupUnit) GetMinMember

func (p *PodGroupUnit) GetMinMember() (int, error)

func (*PodGroupUnit) GetName

func (p *PodGroupUnit) GetName() string

func (*PodGroupUnit) GetNamespace

func (p *PodGroupUnit) GetNamespace() string

func (*PodGroupUnit) GetPod

func (p *PodGroupUnit) GetPod(pod *QueuedPodInfo) *QueuedPodInfo

func (*PodGroupUnit) GetPods

func (p *PodGroupUnit) GetPods() []*QueuedPodInfo

If iterating the map is a performance concern here, we can introduce more complex data structure.

func (*PodGroupUnit) GetPreferredAffinity

func (p *PodGroupUnit) GetPreferredAffinity() ([]UnitAffinityTerm, error)

GetPreferredAffinity returns affinity rules specified in PodGroupAffinity.Preferred

func (*PodGroupUnit) GetPriority

func (p *PodGroupUnit) GetPriority() int32

GetPriority return pod group unit priority. CreatUnit already assigns the value, it's safe to return it directly.

func (*PodGroupUnit) GetRequiredAffinity

func (p *PodGroupUnit) GetRequiredAffinity() ([]UnitAffinityTerm, error)

GetRequiredAffinity returns affinity rules specified in PodGroupAffinity.Required

func (*PodGroupUnit) GetSortRulesForAffinity

func (p *PodGroupUnit) GetSortRulesForAffinity() ([]SortRule, error)

func (*PodGroupUnit) GetTimeoutPeriod

func (p *PodGroupUnit) GetTimeoutPeriod() int32

func (*PodGroupUnit) GetUnitProperty

func (p *PodGroupUnit) GetUnitProperty() UnitProperty

func (*PodGroupUnit) IsDebugModeOn

func (p *PodGroupUnit) IsDebugModeOn() bool

func (*PodGroupUnit) NumPods

func (p *PodGroupUnit) NumPods() int

func (*PodGroupUnit) PodBelongToUnit

func (p *PodGroupUnit) PodBelongToUnit(pod *v1.Pod) bool

func (*PodGroupUnit) ReadyToBePopulated

func (p *PodGroupUnit) ReadyToBePopulated() bool

func (*PodGroupUnit) ResetPods

func (p *PodGroupUnit) ResetPods()

func (*PodGroupUnit) SetEnqueuedTimeStamp

func (p *PodGroupUnit) SetEnqueuedTimeStamp(ts time.Time)

func (*PodGroupUnit) String

func (p *PodGroupUnit) String() string

func (*PodGroupUnit) Type

func (p *PodGroupUnit) Type() ScheduleUnitType

func (*PodGroupUnit) UpdatePod

func (p *PodGroupUnit) UpdatePod(pod *QueuedPodInfo) error

func (*PodGroupUnit) ValidatePodCount

func (p *PodGroupUnit) ValidatePodCount(podCount int) bool

type PodInfo

type PodInfo struct {
	Pod                        *v1.Pod
	RequiredAffinityTerms      []AffinityTerm
	RequiredAntiAffinityTerms  []AffinityTerm
	PreferredAffinityTerms     []WeightedAffinityTerm
	PreferredAntiAffinityTerms []WeightedAffinityTerm
	ParseError                 error

	Res              Resource
	Non0CPU, Non0Mem int64

	PodResourceType      podutil.PodResourceType
	PodResourceTypeError error

	PodKey        string
	PodPriority   int64
	IsSharedCores bool

	PodGroupName string
	PodLauncher  podutil.PodLauncher

	PodPreemptionInfo PodPreemptionInfo
}

PodInfo is a wrapper to a Pod with additional pre-computed information to accelerate processing. This information is typically immutable (e.g., pre-processed inter-pod affinity selectors). This will be stored in splay-tree.

func NewPodInfo

func NewPodInfo(pod *v1.Pod) *PodInfo

NewPodInfo return a new PodInfo

func (*PodInfo) Compare

func (pi *PodInfo) Compare(o splay.Comparable) bool

func (*PodInfo) Equal

func (pi *PodInfo) Equal(pi2 *PodInfo) bool

func (*PodInfo) Key

func (pi *PodInfo) Key() string

func (*PodInfo) MakeMaintainInfo

func (pi *PodInfo) MakeMaintainInfo() splay.MaintainInfo

func (*PodInfo) String

func (pi *PodInfo) String() string

type PodInfoMaintainer

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

func NewPodInfoMaintainer

func NewPodInfoMaintainer(pods ...*PodInfo) *PodInfoMaintainer

func (*PodInfoMaintainer) AddPodInfo

func (m *PodInfoMaintainer) AddPodInfo(p *PodInfo)

func (*PodInfoMaintainer) Clone

func (*PodInfoMaintainer) Equal

func (*PodInfoMaintainer) GetMaintainableInfoByPartition

func (m *PodInfoMaintainer) GetMaintainableInfoByPartition(partitionInfo *PodPartitionInfo) PodMaintainableInfo

func (*PodInfoMaintainer) GetPodInfo

func (m *PodInfoMaintainer) GetPodInfo(key string) *PodInfo

func (*PodInfoMaintainer) GetPods

func (m *PodInfoMaintainer) GetPods() []*PodInfo

func (*PodInfoMaintainer) GetPodsWithAffinity

func (m *PodInfoMaintainer) GetPodsWithAffinity() []*PodInfo

func (*PodInfoMaintainer) GetPodsWithRequiredAntiAffinity

func (m *PodInfoMaintainer) GetPodsWithRequiredAntiAffinity() []*PodInfo

func (*PodInfoMaintainer) GetPrioritiesForPodsMayBePreempted

func (m *PodInfoMaintainer) GetPrioritiesForPodsMayBePreempted(resourceType podutil.PodResourceType) []int64

func (*PodInfoMaintainer) GetVictimCandidates

func (m *PodInfoMaintainer) GetVictimCandidates(partitionInfo *PodPartitionInfo) []*PodInfo

func (*PodInfoMaintainer) Len

func (m *PodInfoMaintainer) Len() int

func (*PodInfoMaintainer) Range

func (m *PodInfoMaintainer) Range(f func(*PodInfo))

func (*PodInfoMaintainer) RemovePodInfo

func (m *PodInfoMaintainer) RemovePodInfo(p *PodInfo)

type PodInfoSlice

type PodInfoSlice interface {
	Add(*PodInfo) bool
	Del(*PodInfo) bool
	Pods() []*PodInfo
	Len() int
	Clone() PodInfoSlice
	Equal(PodInfoSlice) bool
}

PodInfoSlice maintains a linear PodInfo's slice. The time complexity of all methods is O(1).

func NewPodInfoSlice

func NewPodInfoSlice() PodInfoSlice

type PodInfoSliceImpl

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

PodInfoSliceImpl holds a mapping of string keys to slice index, and slice to PodInfo. When adding a PodInfo, we will place it directly at the end of the slice. When deleting a PodInfo, we swap it with the last PodInfo and delete the last PodInfo.

func (*PodInfoSliceImpl) Add

func (hs *PodInfoSliceImpl) Add(pi *PodInfo) bool

func (*PodInfoSliceImpl) Clone

func (hs *PodInfoSliceImpl) Clone() PodInfoSlice

func (*PodInfoSliceImpl) Del

func (hs *PodInfoSliceImpl) Del(pi *PodInfo) bool

func (*PodInfoSliceImpl) Equal

func (hs *PodInfoSliceImpl) Equal(pis PodInfoSlice) bool

func (*PodInfoSliceImpl) Len

func (hs *PodInfoSliceImpl) Len() int

func (*PodInfoSliceImpl) Pods

func (hs *PodInfoSliceImpl) Pods() []*PodInfo

type PodMaintainableInfo

type PodMaintainableInfo struct {
	PodInfo  *PodInfo
	MilliCPU int64
	Memory   int64
}

PodMaintainableInfo implements splay.MaintainInfo. It maintains the subtree information rooted at the current node from the bottom up based on the left and right subtree information. Currently, the information maintained is the sum of all MilliCPU/Memory requests in a subtree. This will be used when we store PodInfo in splay-tree.

func (PodMaintainableInfo) Maintain

type PodPartitionInfo

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

PodPartitionInfo records a pod Priority and a PodResourceType, which we use to partition all ordered pods in Splay-Tree. More precisely, we partition all pods for which `p.Compare` returns false into a subtree. For now, we perform the `p.Compare` operation based on Priority. This will be used when we store PodInfo in splay-tree.

func NewPartitionInfo

func NewPartitionInfo(priorityLower, priorityUpper int64, resourceType podutil.PodResourceType) *PodPartitionInfo

func (*PodPartitionInfo) Compare

func (p *PodPartitionInfo) Compare(o splay.Comparable) bool

type PodPreemptionInfo

type PodPreemptionInfo struct {
	CanBePreempted int

	StartTime               *metav1.Time
	ProtectionDuration      int64
	ProtectionDurationExist bool

	Labels    string
	OwnerType string
	OwnerKey  string
}

type PodProperty

type PodProperty struct {
	Namespace  string
	UnitKey    string
	Priority   int32
	Qos        podutil.PodResourceType
	SubCluster string
}

func ExtractPodProperty

func ExtractPodProperty(pod *v1.Pod) *PodProperty

ExtractPodProperty extract property from Pod, if Pod is nil return nil

func GetPodProperty

func GetPodProperty(state *CycleState) (*PodProperty, error)

GetPodProperty returns the unit property from the state.

func (*PodProperty) ConvertToMetricsLabels

func (p *PodProperty) ConvertToMetricsLabels() metrics.Labels

func (*PodProperty) ConvertToTracingTags

func (p *PodProperty) ConvertToTracingTags() trace.SpanOption

type PostBindPlugin

type PostBindPlugin interface {
	Plugin
	// PostBind is called after a pod is successfully bound. These plugins are
	// informational. A common application of this extension point is for cleaning
	// up. If a plugin needs to clean-up its state after a pod is scheduled and
	// bound, PostBind is the extension point that it should register.
	PostBind(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string)
}

PostBindPlugin is an interface that must be implemented by "PostBind" plugins. These plugins are called after a pod is successfully bound to a node.

type PostVictimCheckingPlugin

type PostVictimCheckingPlugin interface {
	Plugin
	PostVictimChecking(*v1.Pod, *v1.Pod, *CycleState, *CycleState) *Status
}

type PostVictimSearchingPlugin

type PostVictimSearchingPlugin interface {
	Plugin
	PostVictimSearching(*v1.Pod, *PodInfo, *CycleState, *CycleState, *VictimState) *Status
}

type PotentialVictim

type PotentialVictim struct {
	Queue       string `json:"queue"`
	Application string `json:"application"`
}

type PotentialVictims

type PotentialVictims []PotentialVictim

type PotentialVictimsInNodes

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

func NewPotentialVictimsInNodes

func NewPotentialVictimsInNodes() *PotentialVictimsInNodes

func (*PotentialVictimsInNodes) GetPotentialVictims

func (pv *PotentialVictimsInNodes) GetPotentialVictims(node string) []string

func (*PotentialVictimsInNodes) SetPotentialVictims

func (pv *PotentialVictimsInNodes) SetPotentialVictims(node string, potentialVictims []string)

type PreBindPlugin

type PreBindPlugin interface {
	Plugin
	// PreBind is called before binding a pod. All binder plugins must return
	// success or the pod will be rejected and won't be sent for binding.
	PreBind(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string) *Status
}

PreBindPlugin is an interface that must be implemented by "PreBind" plugins. These plugins are called before a pod being scheduled.

type PreFilterExtensions

type PreFilterExtensions interface {
	// AddPod is called by the framework while trying to evaluate the impact
	// of adding podToAdd to the node while scheduling podToSchedule.
	AddPod(ctx context.Context, state *CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo NodeInfo) *Status
	// RemovePod is called by the framework while trying to evaluate the impact
	// of removing podToRemove from the node while scheduling podToSchedule.
	RemovePod(ctx context.Context, state *CycleState, podToSchedule *v1.Pod, podToRemove *v1.Pod, nodeInfo NodeInfo) *Status
}

PreFilterExtensions is an interface that is included in plugins that allow specifying callbacks to make incremental updates to its supposedly pre-calculated state.

type PreFilterPlugin

type PreFilterPlugin interface {
	Plugin
	// PreFilter is called at the beginning of the scheduling cycle. All PreFilter
	// plugins must return success or the pod will be rejected.
	PreFilter(ctx context.Context, state *CycleState, p *v1.Pod) *Status
	// PreFilterExtensions returns a PreFilterExtensions interface if the plugin implements one,
	// or nil if it does not. A Pre-filter plugin can provide extensions to incrementally
	// modify its pre-processed info. The framework guarantees that the extensions
	// AddPod/RemovePod will only be called after PreFilter, possibly on a cloned
	// CycleState, and may call those functions more than once before calling
	// Filter again on a specific node.
	PreFilterExtensions() PreFilterExtensions
}

PreFilterPlugin is an interface that must be implemented by "prefilter" plugins. These plugins are called at the beginning of the scheduling cycle.

type PreScorePlugin

type PreScorePlugin interface {
	Plugin
	// PreScore is called by the scheduling framework after a list of nodes
	// passed the filtering phase. All prescore plugins must return success or
	// the pod will be rejected
	PreScore(ctx context.Context, state *CycleState, pod *v1.Pod, nodes []NodeInfo) *Status
}

PreScorePlugin is an interface for Pre-score plugin. Pre-score is an informational extension point. Plugins will be called with a list of nodes that passed the filtering phase. A plugin may use this data to update internal state or to generate logs/metrics.

type PreemptionError

type PreemptionError string

PreemptionError describe that pod can't preempt any of candidate nodes. Note: we only return PreemptionError when PostPlugins return `Unschedulable` or `UnschedulableAndUnresolvable`.

func NewPreemptionError

func NewPreemptionError(podKey string, candidateNodes int, status *Status) PreemptionError

func (PreemptionError) Error

func (err PreemptionError) Error() string

type PreferNodeExtension

type PreferNodeExtension interface {
	Plugin
	PrePreferNode(context.Context, *CycleState, *CycleState, *v1.Pod, NodeInfo) (NodeInfo, *CycleState, *Status)
	PostPreferNode(context.Context, *CycleState, *CycleState, *v1.Pod, NodeInfo, *Status) *Status // TODO: revisit this, should we pass in Status instead of `fit` bool?
}

type PreferNodeExtensionList

type PreferNodeExtensionList []PreferNodeExtension

func (PreferNodeExtensionList) PostPreferNode

func (l PreferNodeExtensionList) PostPreferNode(ctx context.Context, unitCycleState *CycleState, podCycleState *CycleState, pod *v1.Pod, nodeInfo NodeInfo, status *Status) *Status

func (PreferNodeExtensionList) PrePreferNode

func (l PreferNodeExtensionList) PrePreferNode(ctx context.Context, unitCycleState *CycleState, podCycleState *CycleState, pod *v1.Pod, nodeInfo NodeInfo) (NodeInfo, *CycleState, *Status)

type PreferredNodes

type PreferredNodes interface {
	Add(NodeInfo, ...PreferNodeExtension)
	Get(nodeName string) PreferNodeExtensionList
	List() []NodeInfo
}

func FilterPreferredNodes

func FilterPreferredNodes(preferredNodes PreferredNodes, filterFunc func(NodeInfo) bool) PreferredNodes

func NewPreferredNodes

func NewPreferredNodes() PreferredNodes

type PreferredNodesImpl

type PreferredNodesImpl struct {
	NodeInfoHooks map[string]PreferNodeExtensionList
	NodeHashSlice NodeHashSlice
}

func (*PreferredNodesImpl) Add

func (i *PreferredNodesImpl) Add(nodeInfo NodeInfo, hooks ...PreferNodeExtension)

func (*PreferredNodesImpl) Get

func (*PreferredNodesImpl) List

func (i *PreferredNodesImpl) List() []NodeInfo

type ProtocolPort

type ProtocolPort struct {
	Protocol string
	Port     int32
}

ProtocolPort represents a protocol port pair, e.g. tcp:80.

func NewProtocolPort

func NewProtocolPort(protocol string, port int32) *ProtocolPort

NewProtocolPort creates a ProtocolPort instance.

type QueueSortPlugin

type QueueSortPlugin interface {
	Plugin
	// Less are used to sort pods in the scheduling queue.
	Less(*QueuedPodInfo, *QueuedPodInfo) bool
}

QueueSortPlugin is an interface that must be implemented to get sort score for pods in the scheduling queue.

type QueuedPodInfo

type QueuedPodInfo struct {
	Pod *v1.Pod

	// The time pod added to the scheduling queue.
	Timestamp time.Time
	// Number of schedule attempts before successfully scheduled.
	// It's used to record the # attempts metric.
	Attempts int
	// The time when the pod is added to the queue for the first time. The pod may be added
	// back to the queue multiple times before it's successfully scheduled.
	// It shouldn't be updated once initialized. It's used to record the e2e scheduling
	// latency for a pod.
	InitialAttemptTimestamp time.Time
	// The time when the pod is first attempted to preempt victim pods. There can be
	// multiple attempts for this pod to wait on victim pods to be preempted, this
	// timestamp tracks the first time. It is used to timeout if the victim preemption
	// takes more time.
	InitialPreemptAttemptTimestamp time.Time

	// Fields below are only used by binder, need to move this out of QueuedPodInfo and put them into BinderQueuedPodInfo
	// TODO: (liumeng) implement BinderQueuedPodInfo ?
	// assumedPod
	ReservedPod *v1.Pod
	// NominatedNode contains victims and nominated node for the pod
	NominatedNode *NominatedNode

	// NoConflictStillInHandling indicates the pod passed the conflict checking phase
	// NewlyAssumedButStillInHandling indicates the pod passed the conflict checking phase
	// but is still in processing
	// TODO: when this field is moved from QueuedPodInfo to BindQueuedPodInfo, add more fine-grained states to avoid duplicated checking in binder workflow
	// for example: VictimsDeleting, ReadyForBinding ...
	NewlyAssumedButStillInHandling bool
	AllVolumeBound                 bool

	// QueueSpan is used to record queue updates
	QueueSpan *tracing.SpanInfo

	OwnerReferenceKey string // TODO: revisit this.
	// contains filtered or unexported fields
}

QueuedPodInfo is a Pod wrapper with additional information related to the pod's status in the scheduling queue, such as the timestamp when it's added to the queue.

func (*QueuedPodInfo) DeepCopy

func (pqi *QueuedPodInfo) DeepCopy() *QueuedPodInfo

DeepCopy returns a deep copy of the QueuedPodInfo object.

func (*QueuedPodInfo) GetPodProperty

func (pqi *QueuedPodInfo) GetPodProperty() *PodProperty

func (*QueuedPodInfo) UpdateQueueStage

func (pqi *QueuedPodInfo) UpdateQueueStage(queueStage string)

type QueuedUnitInfo

type QueuedUnitInfo struct {
	UnitKey string
	ScheduleUnit
	// The time unit added to the scheduling queue (will be refreshed).
	Timestamp time.Time
	// Number of schedule attempts before successfully scheduled.
	// It's used to record the # attempts metric.
	Attempts int

	// The time when the unit is added to the queue for the first time. The unit may
	// back to the queue multiple times before it's successfully scheduled.
	// It shouldn't be updated once initialized. It's used to record the e2e sched
	// latency for a pod.
	InitialAttemptTimestamp time.Time

	// QueuePriorityScore is calculated according to pod.Spec, combined with priority. It should not change if no changes in pod.Spec.
	QueuePriorityScore float64
}

QueuedUnitInfo is a Unit wrapper with additional information related to the unit's status in the scheduling queue, such as the timestamp when it's added to the queue.

func NewQueuedUnitInfo

func NewQueuedUnitInfo(unitKey string, unit ScheduleUnit, clock godelutil.Clock) *QueuedUnitInfo

NewQueuedUnitInfo builds a QueuedPodInfo object.

func (*QueuedUnitInfo) String

func (qui *QueuedUnitInfo) String() string

type RecorderFactory

type RecorderFactory func(string) events.EventRecorder

RecorderFactory builds an EventRecorder for a given scheduler name.

type ReservePlugin

type ReservePlugin interface {
	Plugin
	// Reserve is called by the scheduling framework when the scheduler cache is
	// updated. If this method returns a failed Status, the scheduler will call
	// the Unreserve method for all enabled ReservePlugins.
	Reserve(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string) *Status
	// Unreserve is called by the scheduling framework when a reserved pod was
	// rejected, an error occurred during reservation of subsequent plugins, or
	// in a later phase. The Unreserve method implementation must be idempotent
	// and may be called by the scheduler even if the corresponding Reserve
	// method for the same plugin was not called.
	Unreserve(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string)
}

ReservePlugin is an interface for plugins with Reserve and Unreserve methods. These are meant to update the state of the plugin. This concept used to be called 'assume' in the original scheduler. These plugins should return only Success or Error in Status.code. However, the scheduler accepts other valid codes as well. Anything other than Success will lead to rejection of the pod.

type Resource

type Resource struct {
	MilliCPU         int64
	Memory           int64
	EphemeralStorage int64
	// We store allowedPodNumber (which is Node.Status.Allocatable.Pods().Value())
	// explicitly as int, to avoid conversions and improve performance.
	AllowedPodNumber int
	// ScalarResources
	ScalarResources map[v1.ResourceName]int64
}

Resource is a collection of compute resource.

func CalculateResource

func CalculateResource(pod *v1.Pod) (res Resource, non0CPU int64, non0Mem int64)

resourceRequest = max(sum(podSpec.Containers), podSpec.InitContainers) + overHead

func NewResource

func NewResource(rl v1.ResourceList) *Resource

NewResource creates a Resource from ResourceList

func NewResourceFromPtr

func NewResourceFromPtr(rl *v1.ResourceList) *Resource

NewResource creates a Resource from ResourceList pointer

func (*Resource) Add

func (r *Resource) Add(rl v1.ResourceList)

Add adds ResourceList into Resource.

func (*Resource) AddResource

func (r *Resource) AddResource(resource *Resource)

AddResource adds another Resource, this method could avoid Resource to ResourceList conversion

func (*Resource) AddScalar

func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)

AddScalar adds a resource by a scalar value of this resource.

func (*Resource) Clone

func (r *Resource) Clone() *Resource

Clone returns a copy of this resource.

func (*Resource) IsZero

func (r *Resource) IsZero() bool

func (*Resource) ResourceList

func (r *Resource) ResourceList() v1.ResourceList

ResourceList returns a resource list of this resource.

func (*Resource) Satisfy

func (r *Resource) Satisfy(request *Resource) bool

for scalar resources, just check these in available list

func (*Resource) SetMaxResource

func (r *Resource) SetMaxResource(rl v1.ResourceList)

SetMaxResource compares with ResourceList and takes max value for each Resource.

func (*Resource) SetMinResource

func (r *Resource) SetMinResource(rl v1.ResourceList)

SetMinResource compares with ResourceList and takes min value for each Resource.

func (*Resource) SetScalar

func (r *Resource) SetScalar(name v1.ResourceName, quantity int64)

SetScalar sets a resource by a scalar value of this resource.

func (*Resource) Sub

func (r *Resource) Sub(rl v1.ResourceList)

Sub subs ResourceList into Resource.

func (*Resource) SubResource

func (r *Resource) SubResource(resource *Resource)

type ResourceStatus

type ResourceStatus struct {
	Allocatable *resource.Quantity
	Available   *resource.Quantity
	Users       sets.String
}

func (*ResourceStatus) Equal

func (s *ResourceStatus) Equal(s2 *ResourceStatus) bool

type ScheduleUnit

type ScheduleUnit interface {
	// Name is schedule unit name.
	// Name() string
	// Type is the schedule unit type. e.g. PodGroupUnit, DeploymentUnit, etc
	Type() ScheduleUnitType
	// GetKey returns the key of unit. This should be unique globally.
	GetKey() string
	// TODO: Should GetName()、GetNamespace() be there?
	// GetName returns the name of unit.
	GetName() string
	// GetNamespace returns the namespace of unit.
	GetNamespace() string
	// ReadyToBePopulated is used to determine whether the unit is ready to be populated.
	// This is a precondition check to schedule corresponding pods belonging to the unit.
	ReadyToBePopulated() bool
	// PodBelongToUnit is used in event handling to determine if a pod is a naked pod, or it belongs to unit.
	// If it does belong to the unit, the pods will be put into dedicated scheduling queue.
	PodBelongToUnit(pod *v1.Pod) bool
	// GetCreationTimestamp returns the creation timestamp of the original object.
	GetCreationTimestamp() *metav1.Time
	// GetEnqueuedTimestamp returns the timestamp when the unit is added to pending queue.
	GetEnqueuedTimestamp() *metav1.Time
	// GetPriority returns the priority score which is used to rank units in the readyQ
	GetPriority() int32
	// GetPods returns all pods belongs to this unit
	GetPods() []*QueuedPodInfo
	// ValidatePodCount checks if the podCount is a valid number in a batch operation for this unit
	ValidatePodCount(podCount int) bool
	// NumPods return the number of QueuedPodInfos in the unit
	NumPods() int
	// GetPod return a QueuedPodInfo with the same pod.UID
	GetPod(pod *QueuedPodInfo) *QueuedPodInfo
	// AddPod adds QueuedPodInfo into the Unit
	AddPod(pod *QueuedPodInfo) error
	// AddPods adds QueuedPodInfo into the Unit
	AddPods(pods []*QueuedPodInfo) error
	// UpdatePod updates QueuedPodInfo in the Unit
	UpdatePod(pod *QueuedPodInfo) error
	// DeletePod deletes QueuedPodInfo from the Unit
	DeletePod(pod *QueuedPodInfo) error
	// AddPodsIfNotPresent adds pods not existed in the Unit
	AddPodsIfNotPresent(pods ...*QueuedPodInfo) error
	GetTimeoutPeriod() int32
	// GetAnnotations returns the annotations of the Unit
	GetAnnotations() map[string]string
	// GetMinMember gets the min member value
	GetMinMember() (int, error)
	// GetRequiredAffinity returns required affinity scheduling rules, which
	// must be met in scheduling.
	GetRequiredAffinity() ([]UnitAffinityTerm, error)
	// GetPreferredAffinity returns preferred affinity scheduling rules, which
	// don't necessarily have to be satisfied but scheduler will prefer to schedule pods
	// to nodes that satisfy the affinity rules.
	GetPreferredAffinity() ([]UnitAffinityTerm, error)
	// GetAffinityNodeSelector returns the nodeSelector in affinity which defines the specific affinity rules.
	GetAffinityNodeSelector() (*v1.NodeSelector, error)
	// GetSortRulesForAffinity return the rules that indicate how the nodeGroups are sorted.
	// The rule's index in slice is the sort sequence.
	GetSortRulesForAffinity() ([]SortRule, error)
	// IsDebugModeOn checks whether the debug mode is set to on
	IsDebugModeOn() bool
	// SetEnqueuedTimeStamp set the timestamp when the unit is added to pending queue
	SetEnqueuedTimeStamp(time.Time)
	// GetUnitProperty returns unit property to be used by metrics and tracing
	GetUnitProperty() UnitProperty
	// ResetPods will empty all pods for the unit
	// It will be used by binder when we want to re-enqueue the unit (empty pods and then add waiting pods back)
	ResetPods()
}

ScheduleUnit is an interface that must be implemented by `podGroup` or other plugins. These plugins are called in the middle of the scheduling cycle.

type ScheduleUnitProperty

type ScheduleUnitProperty struct {
	// TODO: figure out whether we should embed PodProperty into ScheduleUnitProperty
	*PodProperty
	MinMember int
	UnitType  string
}

func NewScheduleUnitProperty

func NewScheduleUnitProperty(unit ScheduleUnit) (*ScheduleUnitProperty, error)

func (*ScheduleUnitProperty) ConvertToMetricsLabels

func (up *ScheduleUnitProperty) ConvertToMetricsLabels() metrics.Labels

func (*ScheduleUnitProperty) ConvertToTracingTags

func (up *ScheduleUnitProperty) ConvertToTracingTags() trace.SpanOption

func (*ScheduleUnitProperty) GetPodProperty

func (up *ScheduleUnitProperty) GetPodProperty() *PodProperty

type ScheduleUnitType

type ScheduleUnitType string

ScheduleUnitType describes the type of the unit.

const (
	PodGroupUnitType  ScheduleUnitType = "PodGroupUnit"
	SinglePodUnitType ScheduleUnitType = "SinglePodUnit"
)

type SchedulerFramework

type SchedulerFramework interface {
	// RunPreFilterPlugins runs the set of configured prefilter plugins. It returns
	// *Status and its code is set to non-success if any of the plugins returns
	// anything but Success. If a non-success status is returned, then the scheduling
	// cycle is aborted.
	RunPreFilterPlugins(ctx context.Context, state *CycleState, pod *v1.Pod) *Status

	// RunFilterPlugins runs the set of configured filter plugins for pod on
	// the given node. Note that for the node being evaluated, the passed nodeInfo
	// reference could be different from the one in NodeInfoSnapshot map (e.g., pods
	// considered to be running on the node could be different). For example, during
	// preemption, we may pass a copy of the original nodeInfo object that has some pods
	// removed from it to evaluate the possibility of preempting them to
	// schedule the target pod.
	RunFilterPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo NodeInfo, skipPlugins ...string) PluginToStatus

	// RunPreFilterExtensionAddPod calls the AddPod interface for the set of configured
	// PreFilter plugins. It returns directly if any of the plugins return any
	// status other than Success.
	RunPreFilterExtensionAddPod(ctx context.Context, state *CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo NodeInfo) *Status

	// RunPreFilterExtensionRemovePod calls the RemovePod interface for the set of configured
	// PreFilter plugins. It returns directly if any of the plugins return any
	// status other than Success.
	RunPreFilterExtensionRemovePod(ctx context.Context, state *CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo NodeInfo) *Status

	// RunPreScorePlugins runs the set of configured pre-score plugins. If any
	// of these plugins returns any status other than "Success", the given pod is rejected.
	RunPreScorePlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodes []NodeInfo) *Status

	// RunScorePlugins runs the set of configured scoring plugins. It returns a map that
	// stores for each scoring plugin name the corresponding NodeScoreList(s).
	// It also returns *Status, which is set to non-success if any of the plugins returns
	// a non-success status.
	RunScorePlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeNames []string) (PluginToNodeScores, *Status)

	// HasFilterPlugins returns true if at least one filter plugin is defined.
	HasFilterPlugins() bool

	// HasScorePlugins returns true if at least one score plugin is defined.
	HasScorePlugins() bool

	// ListPlugins returns a map of extension point name to list of configured Plugins.
	ListPlugins() map[string]sets.String

	// InitCycleState returns a new cycle state to be used in scheduling process, storing default common data from pod annotation in CycleState
	// This function is used to reduce unmarshalling operations in plugins for pod annotations.
	InitCycleState(pod *v1.Pod) (*CycleState, error)
	SetPotentialVictims(node string, potentialVictims []string)
	GetPotentialVictims(node string) []string

	HasCrossNodesConstraints(ctx context.Context, pod *v1.Pod) bool
}

SchedulerFramework manages the set of plugins in use by Scheduler. Configured plugins are called at specified points in a scheduling context.

type SchedulerFrameworkHandle

type SchedulerFrameworkHandle interface {
	// SwitchType indicates the cluster binary code corresponding to the current workflow.
	// It will be used to resolve BE/GT qos.
	SwitchType() SwitchType
	SubCluster() string
	SchedulerName() string

	// SnapshotSharedLister returns listers from the latest NodeInfo Snapshot. The snapshot
	// is taken at the beginning of a scheduling cycle and remains unchanged until
	// a pod finishes "Permit" point. There is no guarantee that the information
	// remains unchanged in the binding phase of scheduling, so plugins in the binding
	// cycle (pre-bind/bind/post-bind/un-reserve plugin) should not use it,
	// otherwise a concurrent read/write error might occur, they should use scheduler
	// cache instead.
	SnapshotSharedLister() SharedLister

	// ClientSet returns a kubernetes clientSet.
	ClientSet() clientset.Interface
	SharedInformerFactory() informers.SharedInformerFactory
	CRDSharedInformerFactory() crdinformers.SharedInformerFactory
	GetFrameworkForPod(*v1.Pod) (SchedulerFramework, error)

	// Note: The function's underlying access is Snapshot, Snapshot operations are lock-free.
	GetPodGroupInfo(podGroupName string) (*schedulingv1a1.PodGroup, error)
	// Note: The function's underlying access is Snapshot, Snapshot operations are lock-free.
	SetPotentialVictims(node string, potentialVictims []string)
	// Note: The function's underlying access is Snapshot, Snapshot operations are lock-free.
	GetPotentialVictims(node string) []string

	// Note: The function's underlying access is Snapshot, Snapshot operations are lock-free.
	GetPDBItemList() []PDBItem
	// Note: The function's underlying access is Snapshot, Snapshot operations are lock-free.
	GetPDBItemListForOwner(ownerType, ownerKey string) (bool, bool, []string)
	// Note: The function's underlying access is Snapshot, Snapshot operations are lock-free.
	GetOwnerLabels(ownerType, ownerKey string) map[string]string
	GetLoadAwareNodeMetricInfo(nodeName string, resourceType podutil.PodResourceType) *LoadAwareNodeMetricInfo
	GetLoadAwareNodeUsage(nodeName string, resourceType podutil.PodResourceType) *LoadAwareNodeUsage

	GetPreemptionFrameworkForPod(*v1.Pod) SchedulerPreemptionFramework
	GetPreemptionPolicy(deployName string) string
	CachePreemptionPolicy(deployName string, policyName string)
	CleanupPreemptionPolicyForPodOwner()
}

SchedulerFrameworkHandle provides data and some tools that plugins can use in Scheduler. It is passed to the plugin factories at the time of plugin initialization. Plugins must store and use this handle to call framework functions.

type SchedulerPreemptionFramework

type SchedulerPreemptionFramework interface {
	ListPlugins() map[string]sets.String
	HasVictimSearchingPlugin(string) bool
	RunClusterPrePreemptingPlugins(preemptor *v1.Pod, state, commonState *CycleState) *Status
	RunNodePrePreemptingPlugins(preemptor *v1.Pod, nodeInfo NodeInfo, state *CycleState, preemptorState *CycleState) *Status
	RunVictimSearchingPlugins(preemptor *v1.Pod, podInfo *PodInfo, state, preemptionState *CycleState, victimState *VictimState) (Code, string)
	RunPostVictimSearchingPlugins(preemptor *v1.Pod, podInfo *PodInfo, state, preemptionState *CycleState, victimState *VictimState) *Status
	RunNodePostPreemptingPlugins(preemptor *v1.Pod, victims []*v1.Pod, state, commonState *CycleState) *Status

	RunCandidatesSortingPlugins(candidates []*Candidate, candidate *Candidate) []*Candidate
}

type SchedulerUnitFrameworkHandle

type SchedulerUnitFrameworkHandle interface {
	SwitchType() SwitchType
	SubCluster() string
	SchedulerName() string

	GetUnitStatus(string) unitstatus.UnitStatus
	IsCachedPod(pod *v1.Pod) (bool, error)
	GetNodeInfo(nodeName string) NodeInfo
}

type ScoreExtensions

type ScoreExtensions interface {
	// NormalizeScore is called for all node scores produced by the same plugin's "Score"
	// method. A successful run of NormalizeScore will update the scores list and return
	// a success status.
	NormalizeScore(ctx context.Context, state *CycleState, p *v1.Pod, scores NodeScoreList) *Status
}

ScoreExtensions is an interface for Score extended functionality.

type ScorePlugin

type ScorePlugin interface {
	Plugin
	// Score is called on each filtered node. It must return success and an integer
	// indicating the rank of the node. All scoring plugins must return success or
	// the pod will be rejected.
	Score(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string) (int64, *Status)

	// ScoreExtensions returns a ScoreExtensions interface if it implements one, or nil if it does not.
	ScoreExtensions() ScoreExtensions
}

ScorePlugin is an interface that must be implemented by "score" plugins to rank nodes that passed the filtering phase.

type SharedLister

type SharedLister interface {
	NodeInfos() NodeInfoLister
	GetPreemptorsByVictim(string, string) []string
}

SharedLister groups scheduler-specific listers.

type SinglePodUnit

type SinglePodUnit struct {
	Pod *QueuedPodInfo
	// contains filtered or unexported fields
}

func NewSinglePodUnit

func NewSinglePodUnit(podInfo *QueuedPodInfo) *SinglePodUnit

func (*SinglePodUnit) AddPod

func (s *SinglePodUnit) AddPod(pod *QueuedPodInfo) error

func (*SinglePodUnit) AddPods

func (s *SinglePodUnit) AddPods(pods []*QueuedPodInfo) error

func (*SinglePodUnit) AddPodsIfNotPresent

func (s *SinglePodUnit) AddPodsIfNotPresent(pods ...*QueuedPodInfo) error

func (*SinglePodUnit) DeletePod

func (s *SinglePodUnit) DeletePod(pod *QueuedPodInfo) error

func (*SinglePodUnit) GetAffinityNodeSelector

func (s *SinglePodUnit) GetAffinityNodeSelector() (*v1.NodeSelector, error)

func (*SinglePodUnit) GetAnnotations

func (s *SinglePodUnit) GetAnnotations() map[string]string

func (*SinglePodUnit) GetCreationTimestamp

func (s *SinglePodUnit) GetCreationTimestamp() *metav1.Time

func (*SinglePodUnit) GetEnqueuedTimestamp

func (s *SinglePodUnit) GetEnqueuedTimestamp() *metav1.Time

func (*SinglePodUnit) GetKey

func (s *SinglePodUnit) GetKey() string

func (*SinglePodUnit) GetMinMember

func (s *SinglePodUnit) GetMinMember() (int, error)

func (*SinglePodUnit) GetName

func (s *SinglePodUnit) GetName() string

func (*SinglePodUnit) GetNamespace

func (s *SinglePodUnit) GetNamespace() string

func (*SinglePodUnit) GetPod

func (s *SinglePodUnit) GetPod(pod *QueuedPodInfo) *QueuedPodInfo

func (*SinglePodUnit) GetPods

func (s *SinglePodUnit) GetPods() []*QueuedPodInfo

If iterating the map is a performance concern here, we can introduce more complex data structure.

func (*SinglePodUnit) GetPreferredAffinity

func (s *SinglePodUnit) GetPreferredAffinity() ([]UnitAffinityTerm, error)

func (*SinglePodUnit) GetPriority

func (s *SinglePodUnit) GetPriority() int32

func (*SinglePodUnit) GetRequiredAffinity

func (s *SinglePodUnit) GetRequiredAffinity() ([]UnitAffinityTerm, error)

func (*SinglePodUnit) GetSortRulesForAffinity

func (s *SinglePodUnit) GetSortRulesForAffinity() ([]SortRule, error)

func (*SinglePodUnit) GetTimeoutPeriod

func (s *SinglePodUnit) GetTimeoutPeriod() int32

func (*SinglePodUnit) GetUnitProperty

func (s *SinglePodUnit) GetUnitProperty() UnitProperty

func (*SinglePodUnit) IsDebugModeOn

func (s *SinglePodUnit) IsDebugModeOn() bool

func (*SinglePodUnit) NumPods

func (s *SinglePodUnit) NumPods() int

func (*SinglePodUnit) PodBelongToUnit

func (s *SinglePodUnit) PodBelongToUnit(pod *v1.Pod) bool

func (*SinglePodUnit) ReadyToBePopulated

func (s *SinglePodUnit) ReadyToBePopulated() bool

func (*SinglePodUnit) ResetPods

func (s *SinglePodUnit) ResetPods()

func (*SinglePodUnit) SetEnqueuedTimeStamp

func (s *SinglePodUnit) SetEnqueuedTimeStamp(ts time.Time)

func (*SinglePodUnit) String

func (s *SinglePodUnit) String() string

func (*SinglePodUnit) Type

func (s *SinglePodUnit) Type() ScheduleUnitType

func (*SinglePodUnit) UpdatePod

func (s *SinglePodUnit) UpdatePod(pod *QueuedPodInfo) error

func (*SinglePodUnit) ValidatePodCount

func (s *SinglePodUnit) ValidatePodCount(podCnt int) bool

type SortDimension

type SortDimension string
const (
	Capacity SortDimension = "Capacity"

	Available SortDimension = "Available"
)

type SortOrder

type SortOrder string

SortOrder is the order of items.

const (
	// AscendingOrder is the order which items are increasing in a dimension.
	AscendingOrder SortOrder = "Ascending"

	// DescendingOrder is the order which items are decreasing in a dimension.
	DescendingOrder SortOrder = "Descending"
)

type SortResource

type SortResource string

SortResource is the resource that items are sorted by.

const (
	// GPUResource means items are sorted by GPU resource.
	GPUResource SortResource = "GPU"

	// CPUResource means items are sorted by CPU resource.
	CPUResource SortResource = "CPU"

	// MemoryResource means items are sorted by Memory Resource.
	MemoryResource SortResource = "Memory"
)

type SortRule

type SortRule struct {
	// Resource defines the resource name for sorting.
	Resource SortResource

	// Dimension may be Capacity or Available for the moment
	Dimension SortDimension

	// Order may be either Ascending or Descending
	Order SortOrder
}

SortRule defines the rule for sorting items.

func (*SortRule) Valid

func (sr *SortRule) Valid() bool

Valid returns the sort rule is valid or not

type StateData

type StateData interface {
	// Clone is an interface to make a copy of StateData. For performance reasons,
	// clone should make shallow copies for members (e.g., slices or maps) that are not
	// impacted by PreFilter's optional AddPod/RemovePod methods.
	Clone() StateData
}

StateData is a generic type for arbitrary data stored in CycleState.

type StateKey

type StateKey string

StateKey is the type of keys stored in CycleState.

type Status

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

Status indicates the result of running a plugin. It consists of a code, a message and (optionally) an error. When the status code is not `Success`, the reasons should explain why. NOTE: A nil Status is also considered as Success.

func AsStatus

func AsStatus(err error) *Status

AsStatus wraps an error in a Status.

func NewStatus

func NewStatus(code Code, reasons ...string) *Status

NewStatus makes a Status out of the given arguments and returns its pointer.

func (*Status) AppendReason

func (s *Status) AppendReason(reason string)

AppendReason appends given reason to the Status.

func (*Status) AsError

func (s *Status) AsError() error

AsError returns nil if the status is a success; otherwise returns an "error" object with a concatenated message on reasons of the Status.

func (*Status) Code

func (s *Status) Code() Code

Code returns code of the Status.

func (*Status) IsSuccess

func (s *Status) IsSuccess() bool

IsSuccess returns true if and only if "Status" is nil or Code is "Success".

func (*Status) IsUnschedulable

func (s *Status) IsUnschedulable() bool

IsUnschedulable returns true if "Status" is Unschedulable (Unschedulable or UnschedulableAndUnresolvable).

func (*Status) Message

func (s *Status) Message() string

Message returns a concatenated message on reasons of the Status.

func (*Status) Reasons

func (s *Status) Reasons() []string

Reasons returns reasons of the Status.

type StoredUnit

type StoredUnit interface {
	GetPods() []*QueuedPodInfo
	NumPods() int
	GetKey() string
}

type SwitchType

type SwitchType int64

func ClusterIndexToBESwitchType

func ClusterIndexToBESwitchType(x int) SwitchType

func ClusterIndexToGTSwitchType

func ClusterIndexToGTSwitchType(x int) SwitchType

func ParseSwitchTypeFromSubCluster

func ParseSwitchTypeFromSubCluster(subCluster string) SwitchType

func (SwitchType) String

func (st SwitchType) String() string

type TransientSchedulerInfo

type TransientSchedulerInfo struct {
	TransientLock sync.Mutex
	// NodeTransInfo holds the information related to nodeTransientInformation. NodeName is the key here.
	TransNodeInfo nodeTransientInfo
}

TransientSchedulerInfo is a transient structure which is destructed at the end of each scheduling cycle. It consists of items that are valid for a scheduling cycle and is used for message passing across predicates and priorities. Some examples which could be used as fields are number of volumes being used on node, current utilization on node etc. IMPORTANT NOTE: Make sure that each field in this structure is documented along with usage. Expand this structure only when absolutely needed as this data structure will be created and destroyed during every scheduling cycle.

func NewTransientSchedulerInfo

func NewTransientSchedulerInfo() *TransientSchedulerInfo

NewTransientSchedulerInfo returns a new scheduler transient structure with initialized values.

func (*TransientSchedulerInfo) Equal

func (transientSchedInfo *TransientSchedulerInfo) Equal(o *TransientSchedulerInfo) bool

func (*TransientSchedulerInfo) ResetTransientSchedulerInfo

func (transientSchedInfo *TransientSchedulerInfo) ResetTransientSchedulerInfo()

ResetTransientSchedulerInfo resets the TransientSchedulerInfo.

type UnitAffinityTerm

type UnitAffinityTerm struct {
	TopologyKey string
}

type UnitLessFunc

type UnitLessFunc func(unitInfo1, unitInfo2 *QueuedUnitInfo) bool

UnitLessFunc is the function to sort unit info

type UnitProperty

type UnitProperty interface {
	GetPodProperty() *PodProperty
	ObserveProperty
}

type UnitQueueSortPlugin

type UnitQueueSortPlugin interface {
	Plugin
	Less(*QueuedUnitInfo, *QueuedUnitInfo) bool
}

UnitQueueSortPlugin is an interface that must be implemented by "QueueSort" plugins. These plugins are used to sort units in the scheduling unit queue. Only one queue sort plugin may be enabled at a time.

type UnitSchedulingRequest

type UnitSchedulingRequest struct {
	EverScheduled bool
	AllMember     int
}

UnitSchedulingRequest contains necessary info used for making better scheduling decisions

type VictimCheckingPlugin

type VictimCheckingPlugin interface {
	Plugin
	VictimChecking(*v1.Pod, *v1.Pod, *CycleState, *CycleState) (Code, string)
}

type VictimCheckingPluginCollection

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

func NewVictimCheckingPluginCollection

func NewVictimCheckingPluginCollection(plugins []VictimCheckingPlugin, enableQuickPass, forceQuickPass bool) *VictimCheckingPluginCollection

func (*VictimCheckingPluginCollection) EnableQuickPass

func (ppc *VictimCheckingPluginCollection) EnableQuickPass() bool

func (*VictimCheckingPluginCollection) ForceQuickPass

func (ppc *VictimCheckingPluginCollection) ForceQuickPass() bool

func (*VictimCheckingPluginCollection) GetVictimCheckingPlugins

func (ppc *VictimCheckingPluginCollection) GetVictimCheckingPlugins() []VictimCheckingPlugin

func (*VictimCheckingPluginCollection) RejectNotSure

func (ppc *VictimCheckingPluginCollection) RejectNotSure() bool

type VictimCheckingPluginCollectionSpec

type VictimCheckingPluginCollectionSpec struct {
	ForceQuickPassVal  bool
	EnableQuickPassVal bool
	Plugins            []*PluginSpec
}

func NewVictimCheckingPluginCollectionSpec

func NewVictimCheckingPluginCollectionSpec(preemptions []binderconfig.Plugin, enableQuickPass, forceQuickPass bool) *VictimCheckingPluginCollectionSpec

func (*VictimCheckingPluginCollectionSpec) EnableQuickPass

func (pps *VictimCheckingPluginCollectionSpec) EnableQuickPass() bool

func (*VictimCheckingPluginCollectionSpec) ForceQuickPass

func (pps *VictimCheckingPluginCollectionSpec) ForceQuickPass() bool

func (*VictimCheckingPluginCollectionSpec) GetSearchingPlugins

func (pps *VictimCheckingPluginCollectionSpec) GetSearchingPlugins() []*PluginSpec

type VictimPod

type VictimPod struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	UID       string `json:"uid"`
}

type VictimPods

type VictimPods []VictimPod

func (VictimPods) DeepCopy

func (vp VictimPods) DeepCopy() VictimPods

func (VictimPods) Marshall

func (vp VictimPods) Marshall() string

type VictimSearchingPlugin

type VictimSearchingPlugin interface {
	Plugin
	VictimSearching(*v1.Pod, *PodInfo, *CycleState, *CycleState, *VictimState) (Code, string)
}

type VictimSearchingPluginCollection

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

func NewVictimSearchingPluginCollection

func NewVictimSearchingPluginCollection(plugins []VictimSearchingPlugin, enableQuickPass, forceQuickPass, rejectNotSure bool) *VictimSearchingPluginCollection

func (*VictimSearchingPluginCollection) EnableQuickPass

func (ppc *VictimSearchingPluginCollection) EnableQuickPass() bool

func (*VictimSearchingPluginCollection) ForceQuickPass

func (ppc *VictimSearchingPluginCollection) ForceQuickPass() bool

func (*VictimSearchingPluginCollection) GetVictimSearchingPlugins

func (ppc *VictimSearchingPluginCollection) GetVictimSearchingPlugins() []VictimSearchingPlugin

func (*VictimSearchingPluginCollection) RejectNotSure

func (ppc *VictimSearchingPluginCollection) RejectNotSure() bool

type VictimSearchingPluginCollectionSpec

type VictimSearchingPluginCollectionSpec struct {
	ForceQuickPassVal  bool
	EnableQuickPassVal bool
	RejectNotSureVal   bool
	Plugins            []*PluginSpec
}

func NewVictimSearchingPluginCollectionSpec

func NewVictimSearchingPluginCollectionSpec(preemptions []config.Plugin, enableQuickPass, forceQuickPass, rejectNotSure bool) *VictimSearchingPluginCollectionSpec

func (*VictimSearchingPluginCollectionSpec) EnableQuickPass

func (pps *VictimSearchingPluginCollectionSpec) EnableQuickPass() bool

func (*VictimSearchingPluginCollectionSpec) ForceQuickPass

func (pps *VictimSearchingPluginCollectionSpec) ForceQuickPass() bool

func (*VictimSearchingPluginCollectionSpec) GetSearchingPlugins

func (pps *VictimSearchingPluginCollectionSpec) GetSearchingPlugins() []*PluginSpec

func (*VictimSearchingPluginCollectionSpec) RejectNotSure

func (pps *VictimSearchingPluginCollectionSpec) RejectNotSure() bool

type VictimState

type VictimState struct {
	MatchedPDBIndexes      []int
	MatchedPDBIndexesExist bool
}

func NewVictimState

func NewVictimState() *VictimState

type Victims

type Victims struct {
	Pods            []*v1.Pod
	PreemptionState *CycleState
}

Victims represents: Pods: a group of pods expected to be preempted. PreemptionState: save state of all victims in each node

func (Victims) String

func (v Victims) String() string

type WeightedAffinityTerm

type WeightedAffinityTerm struct {
	AffinityTerm
	Weight int32
}

WeightedAffinityTerm is a "processed" representation of v1.WeightedAffinityTerm.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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