Documentation ¶
Overview ¶
Package scheduler contains a generic Scheduler interface and several implementations.
Index ¶
- func MapPodsToMachines(lister PodLister) (map[string][]api.Pod, error)
- func NoDiskConflict(pod api.Pod, existingPods []api.Pod, node string) (bool, error)
- func PodFitsPorts(pod api.Pod, existingPods []api.Pod, node string) (bool, error)
- type ClientNodeInfo
- type FakeMinionLister
- type FakePodLister
- type FitPredicate
- type HostPriority
- type HostPriorityList
- func CalculateSpreadPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)
- func EqualPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)
- func LeastRequestedPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error)
- type MinionLister
- type NodeInfo
- type NodeSelector
- type PodLister
- type PriorityFunction
- type ResourceFit
- type Scheduler
- type StaticNodeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapPodsToMachines ¶
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 ¶ added in v0.5.2
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?
Types ¶
type ClientNodeInfo ¶
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 ¶
FakePodLister implements PodLister on an []api.Pods for test purposes.
type FitPredicate ¶
FitPredicate is a function that indicates if a pod fits into an existing node.
func NewResourceFitPredicate ¶
func NewResourceFitPredicate(info NodeInfo) FitPredicate
func NewSelectorMatchPredicate ¶ added in v0.5.2
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 NodeSelector ¶ added in v0.5.2
type NodeSelector struct {
// contains filtered or unexported fields
}
func (*NodeSelector) PodSelectorMatches ¶ added in v0.5.2
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)