Documentation ¶
Overview ¶
Package scheduler contains a generic Scheduler interface and several implementations.
Index ¶
- func MapPodsToMachines(lister PodLister) (map[string][]api.Pod, 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 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.
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
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 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)