kubernetes: k8s.io/kubernetes/pkg/scheduler/core Index | Files

package core

import "k8s.io/kubernetes/pkg/scheduler/core"

Index

Package Files

extender.go generic_scheduler.go

Constants

const (
    // DefaultExtenderTimeout defines the default extender timeout in second.
    DefaultExtenderTimeout = 5 * time.Second
)
const (
    // NoNodeAvailableMsg is used to format message when no nodes available.
    NoNodeAvailableMsg = "0/%v nodes are available"
)

Variables

var ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")

ErrNoNodesAvailable is used to describe the error that no nodes available to schedule pods.

func Equal Uses

func Equal(e1, e2 *HTTPExtender) bool

Equal is used to check if two extenders are equal ignoring the client field, exported for testing

type FitError Uses

type FitError struct {
    Pod                   *v1.Pod
    NumAllNodes           int
    FilteredNodesStatuses framework.NodeToStatusMap
}

FitError describes a fit error of a pod.

func (*FitError) Error Uses

func (f *FitError) Error() string

Error returns detailed information of why the pod failed to fit on each node

type HTTPExtender Uses

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

HTTPExtender implements the SchedulerExtender interface.

func (*HTTPExtender) Bind Uses

func (h *HTTPExtender) Bind(binding *v1.Binding) error

Bind delegates the action of binding a pod to a node to the extender.

func (*HTTPExtender) Filter Uses

func (h *HTTPExtender) Filter(
    pod *v1.Pod,
    nodes []*v1.Node,
) ([]*v1.Node, extenderv1.FailedNodesMap, error)

Filter based on extender implemented predicate functions. The filtered list is expected to be a subset of the supplied list; otherwise the function returns an error. failedNodesMap optionally contains the list of failed nodes and failure reasons.

func (*HTTPExtender) IsBinder Uses

func (h *HTTPExtender) IsBinder() bool

IsBinder returns whether this extender is configured for the Bind method.

func (*HTTPExtender) IsIgnorable Uses

func (h *HTTPExtender) IsIgnorable() bool

IsIgnorable returns true indicates scheduling should not fail when this extender is unavailable

func (*HTTPExtender) IsInterested Uses

func (h *HTTPExtender) IsInterested(pod *v1.Pod) bool

IsInterested returns true if at least one extended resource requested by this pod is managed by this extender.

func (*HTTPExtender) Name Uses

func (h *HTTPExtender) Name() string

Name returns extenderURL to identify the extender.

func (*HTTPExtender) Prioritize Uses

func (h *HTTPExtender) Prioritize(pod *v1.Pod, nodes []*v1.Node) (*extenderv1.HostPriorityList, int64, error)

Prioritize based on extender implemented priority functions. Weight*priority is added up for each such priority function. The returned score is added to the score computed by Kubernetes scheduler. The total score is used to do the host selection.

func (*HTTPExtender) ProcessPreemption Uses

func (h *HTTPExtender) ProcessPreemption(
    pod *v1.Pod,
    nodeToVictims map[*v1.Node]*extenderv1.Victims,
    nodeInfos listers.NodeInfoLister,
) (map[*v1.Node]*extenderv1.Victims, error)

ProcessPreemption returns filtered candidate nodes and victims after running preemption logic in extender.

func (*HTTPExtender) SupportsPreemption Uses

func (h *HTTPExtender) SupportsPreemption() bool

SupportsPreemption returns true if an extender supports preemption. An extender should have preempt verb defined and enabled its own node cache.

type ScheduleAlgorithm Uses

type ScheduleAlgorithm interface {
    Schedule(context.Context, *profile.Profile, *framework.CycleState, *v1.Pod) (scheduleResult ScheduleResult, err error)
    // Preempt receives scheduling errors for a pod and tries to create room for
    // the pod by preempting lower priority pods if possible.
    // It returns the node where preemption happened, a list of preempted pods, a
    // list of pods whose nominated node name should be removed, and error if any.
    Preempt(context.Context, *profile.Profile, *framework.CycleState, *v1.Pod, error) (selectedNode *v1.Node, preemptedPods []*v1.Pod, cleanupNominatedPods []*v1.Pod, err error)
    // Prioritizers returns a slice of priority config. This is exposed for
    // testing.
    Extenders() []SchedulerExtender
}

ScheduleAlgorithm is an interface implemented by things that know how to schedule pods onto machines. TODO: Rename this type.

func NewGenericScheduler Uses

func NewGenericScheduler(
    cache internalcache.Cache,
    podQueue internalqueue.SchedulingQueue,
    nodeInfoSnapshot *internalcache.Snapshot,
    extenders []SchedulerExtender,
    pvcLister corelisters.PersistentVolumeClaimLister,
    pdbLister policylisters.PodDisruptionBudgetLister,
    disablePreemption bool,
    percentageOfNodesToScore int32,
    enableNonPreempting bool) ScheduleAlgorithm

NewGenericScheduler creates a genericScheduler object.

type ScheduleResult Uses

type ScheduleResult struct {
    // Name of the scheduler suggest host
    SuggestedHost string
    // Number of nodes scheduler evaluated on one pod scheduled
    EvaluatedNodes int
    // Number of feasible nodes on one pod scheduled
    FeasibleNodes int
}

ScheduleResult represents the result of one pod scheduled. It will contain the final selected Node, along with the selected intermediate information.

type SchedulerExtender Uses

type SchedulerExtender interface {
    // Name returns a unique name that identifies the extender.
    Name() string

    // 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) (filteredNodes []*v1.Node, failedNodesMap extenderv1.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 *extenderv1.HostPriorityList, weight int64, 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

    // IsInterested returns true if at least one extended resource requested by
    // this pod is managed by this extender.
    IsInterested(pod *v1.Pod) bool

    // ProcessPreemption returns nodes with their victim pods processed by extender based on
    // given:
    //   1. Pod to schedule
    //   2. Candidate nodes and victim pods (nodeToVictims) generated by previous scheduling process.
    //   3. nodeNameToInfo to restore v1.Node from node name if extender cache is enabled.
    // The possible changes made by extender may include:
    //   1. Subset of given candidate nodes after preemption phase of extender.
    //   2. A different set of victim pod for every given candidate node after preemption phase of extender.
    ProcessPreemption(
        pod *v1.Pod,
        nodeToVictims map[*v1.Node]*extenderv1.Victims,
        nodeInfos listers.NodeInfoLister) (map[*v1.Node]*extenderv1.Victims, error)

    // SupportsPreemption returns if the scheduler extender support preemption or not.
    SupportsPreemption() bool

    // IsIgnorable returns true indicates scheduling should not fail when this extender
    // is unavailable. This gives scheduler ability to fail fast and tolerate non-critical extenders as well.
    IsIgnorable() 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.

func NewHTTPExtender Uses

func NewHTTPExtender(config *schedulerapi.Extender) (SchedulerExtender, error)

NewHTTPExtender creates an HTTPExtender object.

Package core imports 35 packages (graph) and is imported by 133 packages. Updated 2020-02-28. Refresh now. Tools for package owners.