kubernetes: github.com/erikstmartin/kubernetes/pkg/scheduler Index | Files

package scheduler

import "github.com/erikstmartin/kubernetes/pkg/scheduler"

Package scheduler contains a generic Scheduler interface and several implementations.


Package Files

doc.go generic_scheduler.go listers.go predicates.go priorities.go scheduler.go spreading.go types.go

func MapPodsToMachines Uses

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 Uses

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 Uses

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

type ClientNodeInfo Uses

type ClientNodeInfo struct {

func (ClientNodeInfo) GetNodeInfo Uses

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

type FakeMinionLister Uses

type FakeMinionLister api.MinionList

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

func (FakeMinionLister) List Uses

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

List returns minions as a []string.

type FakePodLister Uses

type FakePodLister []api.Pod

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

func (FakePodLister) ListPods Uses

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

ListPods returns []api.Pod matching a query.

type FitPredicate Uses

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 Uses

func NewResourceFitPredicate(info NodeInfo) FitPredicate

func NewSelectorMatchPredicate Uses

func NewSelectorMatchPredicate(info NodeInfo) FitPredicate

type HostPriority Uses

type HostPriority struct {
    // contains filtered or unexported fields

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

type HostPriorityList Uses

type HostPriorityList []HostPriority

func CalculateSpreadPriority Uses

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 Uses

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 Uses

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 Uses

func (h HostPriorityList) Len() int

func (HostPriorityList) Less Uses

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

func (HostPriorityList) Swap Uses

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

type MinionLister Uses

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

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

type NodeInfo Uses

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

type NodeSelector Uses

type NodeSelector struct {
    // contains filtered or unexported fields

func (*NodeSelector) PodSelectorMatches Uses

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

type PodLister Uses

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 Uses

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

type ResourceFit Uses

type ResourceFit struct {
    // contains filtered or unexported fields

func (*ResourceFit) PodFitsResources Uses

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 Uses

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 Uses

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

func NewSpreadingScheduler Uses

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

type StaticNodeInfo Uses

type StaticNodeInfo struct {

func (StaticNodeInfo) GetNodeInfo Uses

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

Package scheduler imports 9 packages (graph). Updated 2018-04-10. Refresh now. Tools for package owners.