scheduler

package
v0.0.0-...-7eceafa Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2014 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package scheduler contains a generic Scheduler interface and several implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapPodsToMachines

func MapPodsToMachines(lister PodLister) (map[string][]api.Pod, error)

MapPodsToMachines obtains a list of pods and pivots that list into a map where the keys are host names and the values are the list of pods running on that host.

func NoDiskConflict

func NoDiskConflict(pod api.Pod, existingPods []api.Pod, node string) (bool, error)

NoDiskConflict evaluates if a pod can fit due to the volumes it requests, and those that are already mounted. Some times of volumes are mounted onto node machines. For now, these mounts are exclusive so if there is already a volume mounted on that node, another pod can't schedule there. This is GCE specific for now. TODO: migrate this into some per-volume specific code?

func PodFitsPorts

func PodFitsPorts(pod api.Pod, existingPods []api.Pod, node string) (bool, error)

Types

type ClientNodeInfo

type ClientNodeInfo struct {
	*client.Client
}

func (ClientNodeInfo) GetNodeInfo

func (nodes ClientNodeInfo) GetNodeInfo(nodeID string) (*api.Minion, error)

type FakeMinionLister

type FakeMinionLister api.MinionList

FakeMinionLister implements MinionLister on a []string for test purposes.

func (FakeMinionLister) List

func (f FakeMinionLister) List() (api.MinionList, error)

List returns minions as a []string.

type FakePodLister

type FakePodLister []api.Pod

FakePodLister implements PodLister on an []api.Pods for test purposes.

func (FakePodLister) ListPods

func (f FakePodLister) ListPods(s labels.Selector) (selected []api.Pod, err error)

ListPods returns []api.Pod matching a query.

type FitPredicate

type FitPredicate func(pod api.Pod, existingPods []api.Pod, node string) (bool, error)

FitPredicate is a function that indicates if a pod fits into an existing node.

func NewResourceFitPredicate

func NewResourceFitPredicate(info NodeInfo) FitPredicate

func NewSelectorMatchPredicate

func NewSelectorMatchPredicate(info NodeInfo) FitPredicate

type HostPriority

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

HostPriority represents the priority of scheduling to a particular host, lower priority is better.

type HostPriorityList

type HostPriorityList []HostPriority

func CalculateSpreadPriority

func CalculateSpreadPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)

CalculateSpreadPriority spreads pods by minimizing the number of pods on the same machine with the same labels. Importantly, if there are services in the system that span multiple heterogenous sets of pods, this spreading priority may not provide optimal spreading for the members of that Service. TODO: consider if we want to include Service label sets in the scheduling priority.

func EqualPriority

func EqualPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)

EqualPriority is a prioritizer function that gives an equal weight of one to all nodes

func LeastRequestedPriority

func LeastRequestedPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)

LeastRequestedPriority is a priority function that favors nodes with fewer requested resources. It calculates the percentage of memory and CPU requested by pods scheduled on the node, and prioritizes based on the minimum of the average of the fraction of requested to capacity. Details: (Sum(requested cpu) / Capacity + Sum(requested memory) / Capacity) * 50

func (HostPriorityList) Len

func (h HostPriorityList) Len() int

func (HostPriorityList) Less

func (h HostPriorityList) Less(i, j int) bool

func (HostPriorityList) Swap

func (h HostPriorityList) Swap(i, j int)

type MinionLister

type MinionLister interface {
	List() (list api.MinionList, err error)
}

MinionLister interface represents anything that can list minions for a scheduler.

type NodeInfo

type NodeInfo interface {
	GetNodeInfo(nodeID string) (*api.Minion, error)
}

type NodeSelector

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

func (*NodeSelector) PodSelectorMatches

func (n *NodeSelector) PodSelectorMatches(pod api.Pod, existingPods []api.Pod, node string) (bool, error)

type PodLister

type PodLister interface {
	// TODO: make this exactly the same as client's ListPods() method...
	ListPods(labels.Selector) ([]api.Pod, error)
}

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

type PriorityFunction

type PriorityFunction func(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)

type ResourceFit

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

func (*ResourceFit) PodFitsResources

func (r *ResourceFit) PodFitsResources(pod api.Pod, existingPods []api.Pod, node string) (bool, error)

PodFitsResources calculates fit based on requested, rather than used resources

type Scheduler

type Scheduler interface {
	Schedule(api.Pod, MinionLister) (selectedMachine string, err error)
}

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

func NewGenericScheduler

func NewGenericScheduler(predicates []FitPredicate, prioritizer PriorityFunction, pods PodLister, random *rand.Rand) Scheduler

func NewSpreadingScheduler

func NewSpreadingScheduler(podLister PodLister, minionLister MinionLister, predicates []FitPredicate, random *rand.Rand) Scheduler

type StaticNodeInfo

type StaticNodeInfo struct {
	*api.MinionList
}

func (StaticNodeInfo) GetNodeInfo

func (nodes StaticNodeInfo) GetNodeInfo(nodeID string) (*api.Minion, error)

Jump to

Keyboard shortcuts

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