algorithm

package
v1.15.8-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package algorithm contains a generic Scheduler interface and several implementations.

Index

Constants

This section is empty.

Variables

View Source
var NodeFieldSelectorKeys = map[string]func(*v1.Node) string{
	schedulerapi.NodeFieldSelectorKeyNodeName: func(n *v1.Node) string { return n.Name },
}

NodeFieldSelectorKeys is a map that: the key are node field selector keys; the values are the functions to get the value of the node field.

Functions

This section is empty.

Types

type ControllerLister

type ControllerLister interface {
	// Lists all the replication controllers
	List(labels.Selector) ([]*v1.ReplicationController, error)
	// Gets the services for the given pod
	GetPodControllers(*v1.Pod) ([]*v1.ReplicationController, error)
}

ControllerLister interface represents anything that can produce a list of ReplicationController; the list is consumed by a scheduler.

type EmptyControllerLister

type EmptyControllerLister struct{}

EmptyControllerLister implements ControllerLister on []v1.ReplicationController returning empty data

func (EmptyControllerLister) GetPodControllers

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

GetPodControllers returns nil

func (EmptyControllerLister) List

List returns nil

type EmptyReplicaSetLister

type EmptyReplicaSetLister struct{}

EmptyReplicaSetLister implements ReplicaSetLister on []extensions.ReplicaSet returning empty data

func (EmptyReplicaSetLister) GetPodReplicaSets

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

GetPodReplicaSets returns nil

type EmptyStatefulSetLister

type EmptyStatefulSetLister struct{}

EmptyStatefulSetLister implements StatefulSetLister on []apps.StatefulSet returning empty data.

func (EmptyStatefulSetLister) GetPodStatefulSets

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

GetPodStatefulSets of EmptyStatefulSetLister returns nil.

type NodeLister

type NodeLister interface {
	// We explicitly return []*v1.Node, instead of v1.NodeList, to avoid
	// performing expensive copies that are unneeded.
	List() ([]*v1.Node, error)
}

NodeLister interface represents anything that can list nodes for a scheduler.

type PDBLister added in v1.13.0

type PDBLister interface {
	// List() returns a list of PodDisruptionBudgets matching the selector.
	List(labels.Selector) ([]*policyv1beta1.PodDisruptionBudget, error)
}

PDBLister interface represents anything that can list PodDisruptionBudget objects.

type PodFilter added in v1.13.2

type PodFilter func(*v1.Pod) bool

PodFilter is a function to filter a pod. If pod passed return true else return false.

type PodLister

type PodLister interface {
	// We explicitly return []*v1.Pod, instead of v1.PodList, to avoid
	// performing expensive copies that are unneeded.
	List(labels.Selector) ([]*v1.Pod, error)
	// This is similar to "List()", but the returned slice does not
	// contain pods that don't pass `podFilter`.
	FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)
}

PodLister interface represents anything that can list pods for a scheduler.

type ReplicaSetLister

type ReplicaSetLister interface {
	// Gets the replicasets for the given pod
	GetPodReplicaSets(*v1.Pod) ([]*apps.ReplicaSet, error)
}

ReplicaSetLister interface represents anything that can produce a list of ReplicaSet; the list is consumed by a scheduler.

type SchedulerExtender

type SchedulerExtender interface {
	// Name returns a unique name that identifies the extender.
	Name() string

	// Filter based on extender-implemented predicate functions. The filtered list is
	// expected to be a subset of the supplied list. failedNodesMap optionally contains
	// the list of failed nodes and failure reasons.
	Filter(pod *v1.Pod,
		nodes []*v1.Node, nodeNameToInfo map[string]*schedulernodeinfo.NodeInfo,
	) (filteredNodes []*v1.Node, failedNodesMap schedulerapi.FailedNodesMap, err error)

	// Prioritize based on extender-implemented priority functions. The returned scores & weight
	// are used to compute the weighted score for an extender. The weighted scores are added to
	// the scores computed  by Kubernetes scheduler. The total scores are used to do the host selection.
	Prioritize(pod *v1.Pod, nodes []*v1.Node) (hostPriorities *schedulerapi.HostPriorityList, weight int, err error)

	// Bind delegates the action of binding a pod to a node to the extender.
	Bind(binding *v1.Binding) error

	// IsBinder returns whether this extender is configured for the Bind method.
	IsBinder() bool

	// IsInterested returns true if at least one extended resource requested by
	// this pod is managed by this extender.
	IsInterested(pod *v1.Pod) bool

	// ProcessPreemption returns nodes with their victim pods processed by extender based on
	// given:
	//   1. Pod to schedule
	//   2. Candidate nodes and victim pods (nodeToVictims) generated by previous scheduling process.
	//   3. nodeNameToInfo to restore v1.Node from node name if extender cache is enabled.
	// The possible changes made by extender may include:
	//   1. Subset of given candidate nodes after preemption phase of extender.
	//   2. A different set of victim pod for every given candidate node after preemption phase of extender.
	ProcessPreemption(
		pod *v1.Pod,
		nodeToVictims map[*v1.Node]*schedulerapi.Victims,
		nodeNameToInfo map[string]*schedulernodeinfo.NodeInfo,
	) (map[*v1.Node]*schedulerapi.Victims, error)

	// SupportsPreemption returns if the scheduler extender support preemption or not.
	SupportsPreemption() bool

	// IsIgnorable returns true indicates scheduling should not fail when this extender
	// is unavailable. This gives scheduler ability to fail fast and tolerate non-critical extenders as well.
	IsIgnorable() bool
}

SchedulerExtender is an interface for external processes to influence scheduling decisions made by Kubernetes. This is typically needed for resources not directly managed by Kubernetes.

type ServiceLister

type ServiceLister interface {
	// Lists all the services
	List(labels.Selector) ([]*v1.Service, error)
	// Gets the services for the given pod
	GetPodServices(*v1.Pod) ([]*v1.Service, error)
}

ServiceLister interface represents anything that can produce a list of services; the list is consumed by a scheduler.

type StatefulSetLister

type StatefulSetLister interface {
	// Gets the StatefulSet for the given pod.
	GetPodStatefulSets(*v1.Pod) ([]*apps.StatefulSet, error)
}

StatefulSetLister interface represents anything that can produce a list of StatefulSet; the list is consumed by a scheduler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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