algorithm

package
v1.7.10-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package scheduler contains a generic Scheduler interface and several implementations.

Index

Constants

View Source
const (
	// When feature-gate for TaintBasedEvictions=true flag is enabled,
	// TaintNodeNotReady would be automatically added by node controller
	// when node is not ready, and removed when node becomes ready.
	TaintNodeNotReady = "node.alpha.kubernetes.io/notReady"

	// When feature-gate for TaintBasedEvictions=true flag is enabled,
	// TaintNodeUnreachable would be automatically added by node controller
	// when node becomes unreachable (corresponding to NodeReady status ConditionUnknown)
	// and removed when node becomes reachable (NodeReady status ConditionTrue).
	TaintNodeUnreachable = "node.alpha.kubernetes.io/unreachable"

	// When kubelet is started with the "external" cloud provider, then
	// it sets this taint on a node to mark it as unusable, until a controller
	// from the cloud-controller-manager intitializes this node, and then removes
	// the taint
	TaintExternalCloudProvider = "node.cloudprovider.kubernetes.io/uninitialized"
)

Variables

This section is empty.

Functions

func EmptyMetadataProducer added in v1.5.0

func EmptyMetadataProducer(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}

EmptyMetadataProducer returns a no-op MetadataProducer type.

Types

type ControllerLister added in v1.1.0

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 added in v1.1.0

type EmptyControllerLister struct{}

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

func (EmptyControllerLister) GetPodControllers added in v1.1.0

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

GetPodControllers returns nil

func (EmptyControllerLister) List added in v1.1.0

List returns nil

type EmptyReplicaSetLister added in v1.2.0

type EmptyReplicaSetLister struct{}

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

func (EmptyReplicaSetLister) GetPodReplicaSets added in v1.2.0

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

GetPodReplicaSets returns nil

type EmptyStatefulSetLister added in v1.6.0

type EmptyStatefulSetLister struct{}

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

func (EmptyStatefulSetLister) GetPodStatefulSets added in v1.6.0

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

GetPodStatefulSets of EmptyStatefulSetLister returns nil.

type FitPredicate

type FitPredicate func(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (bool, []PredicateFailureReason, error)

FitPredicate is a function that indicates if a pod fits into an existing node. The failure information is given by the error. TODO: Change interface{} to a specific type.

type GetEquivalencePodFunc added in v1.5.0

type GetEquivalencePodFunc func(pod *v1.Pod) interface{}

type MetadataProducer added in v1.5.0

type MetadataProducer func(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}

MetadataProducer is a function that computes metadata for a given pod.

type NodeLister added in v1.1.0

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 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)
}

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

type PredicateFailureReason added in v1.4.0

type PredicateFailureReason interface {
	GetReason() string
}

type PriorityConfig

type PriorityConfig struct {
	Map    PriorityMapFunction
	Reduce PriorityReduceFunction
	// TODO: Remove it after migrating all functions to
	// Map-Reduce pattern.
	Function PriorityFunction
	Weight   int
}

type PriorityFunction

type PriorityFunction func(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error)

DEPRECATED Use Map-Reduce pattern for priority functions.

type PriorityMapFunction added in v1.5.0

type PriorityMapFunction func(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)

PriorityMapFunction is a function that computes per-node results for a given node. TODO: Figure out the exact API of this method. TODO: Change interface{} to a specific type.

type PriorityReduceFunction added in v1.5.0

type PriorityReduceFunction func(pod *v1.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error

PriorityReduceFunction is a function that aggregated per-node results and computes final scores for all nodes. TODO: Figure out the exact API of this method. TODO: Change interface{} to a specific type.

type ReplicaSetLister added in v1.2.0

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

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

type ScheduleAlgorithm

type ScheduleAlgorithm interface {
	Schedule(*v1.Pod, NodeLister) (selectedMachine string, err error)
	// Predicates() returns a pointer to a map of predicate functions. This is
	// exposed for testing.
	Predicates() map[string]FitPredicate
	// Prioritizers returns a slice of priority config. This is exposed for
	// testing.
	Prioritizers() []PriorityConfig
}

ScheduleAlgorithm is an interface implemented by things that know how to schedule pods onto machines.

type SchedulerExtender added in v1.2.0

type SchedulerExtender interface {
	// 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]*schedulercache.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
}

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 added in v1.6.0

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