{"modulePath":"github.com/GoogleCloudPlatform/kubernetes","version":"v1.9.11","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package algorithm\n\nPackage scheduler contains a generic Scheduler interface and several implementations.\n\n## Constants\n\n```go\nconst (\n\t// When feature-gate for TaintBasedEvictions=true flag is enabled,\n\t// TaintNodeNotReady would be automatically added by node controller\n\t// when node is not ready, and removed when node becomes ready.\n\tTaintNodeNotReady = \"node.kubernetes.io/not-ready\"\n\n\t// DeprecatedTaintNodeNotReady is the deprecated version of TaintNodeNotReady.\n\t// It is deprecated since 1.9\n\tDeprecatedTaintNodeNotReady = \"node.alpha.kubernetes.io/notReady\"\n\n\t// When feature-gate for TaintBasedEvictions=true flag is enabled,\n\t// TaintNodeUnreachable would be automatically added by node controller\n\t// when node becomes unreachable (corresponding to NodeReady status ConditionUnknown)\n\t// and removed when node becomes reachable (NodeReady status ConditionTrue).\n\tTaintNodeUnreachable = \"node.kubernetes.io/unreachable\"\n\n\t// DeprecatedTaintNodeUnreachable is the deprecated version of TaintNodeUnreachable.\n\t// It is deprecated since 1.9\n\tDeprecatedTaintNodeUnreachable = \"node.alpha.kubernetes.io/unreachable\"\n\n\t// When feature-gate for TaintBasedEvictions=true flag is enabled,\n\t// TaintNodeOutOfDisk would be automatically added by node controller\n\t// when node becomes out of disk, and removed when node has enough disk.\n\tTaintNodeOutOfDisk = \"node.kubernetes.io/out-of-disk\"\n\n\t// When feature-gate for TaintBasedEvictions=true flag is enabled,\n\t// TaintNodeMemoryPressure would be automatically added by node controller\n\t// when node has memory pressure, and removed when node has enough memory.\n\tTaintNodeMemoryPressure = \"node.kubernetes.io/memory-pressure\"\n\n\t// When feature-gate for TaintBasedEvictions=true flag is enabled,\n\t// TaintNodeDiskPressure would be automatically added by node controller\n\t// when node has disk pressure, and removed when node has enough disk.\n\tTaintNodeDiskPressure = \"node.kubernetes.io/disk-pressure\"\n\n\t// When feature-gate for TaintBasedEvictions=true flag is enabled,\n\t// TaintNodeNetworkUnavailable would be automatically added by node controller\n\t// when node's network is unavailable, and removed when network becomes ready.\n\tTaintNodeNetworkUnavailable = \"node.kubernetes.io/network-unavailable\"\n\n\t// When kubelet is started with the \"external\" cloud provider, then\n\t// it sets this taint on a node to mark it as unusable, until a controller\n\t// from the cloud-controller-manager intitializes this node, and then removes\n\t// the taint\n\tTaintExternalCloudProvider = \"node.cloudprovider.kubernetes.io/uninitialized\"\n)\n```\n\n## Functions\n\n```go\nfunc EmptyMetadataProducer(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}\n```\nEmptyMetadataProducer returns a no-op MetadataProducer type.\n\n## Types\n\n```go\ntype ControllerLister interface {\n\t// Lists all the replication controllers\n\tList(labels.Selector) ([]*v1.ReplicationController, error)\n\t// Gets the services for the given pod\n\tGetPodControllers(*v1.Pod) ([]*v1.ReplicationController, error)\n}\n```\nControllerLister interface represents anything that can produce a list of ReplicationController; the list is consumed by a scheduler.\n\n```go\ntype EmptyControllerLister struct{}\n```\nEmptyControllerLister implements ControllerLister on \\[]v1.ReplicationController returning empty data\n\n```go\nfunc (f EmptyControllerLister) GetPodControllers(pod *v1.Pod) (controllers []*v1.ReplicationController, err error)\n```\nGetPodControllers returns nil\n\n```go\nfunc (f EmptyControllerLister) List(labels.Selector) ([]*v1.ReplicationController, error)\n```\nList returns nil\n\n```go\ntype EmptyReplicaSetLister struct{}\n```\nEmptyReplicaSetLister implements ReplicaSetLister on \\[]extensions.ReplicaSet returning empty data\n\n```go\nfunc (f EmptyReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) (rss []*extensions.ReplicaSet, err error)\n```\nGetPodReplicaSets returns nil\n\n```go\ntype EmptyStatefulSetLister struct{}\n```\nEmptyStatefulSetLister implements StatefulSetLister on \\[]apps.StatefulSet returning empty data.\n\n```go\nfunc (f EmptyStatefulSetLister) GetPodStatefulSets(pod *v1.Pod) (sss []*apps.StatefulSet, err error)\n```\nGetPodStatefulSets of EmptyStatefulSetLister returns nil.\n\n```go\ntype FitPredicate func(pod *v1.Pod, meta PredicateMetadata, nodeInfo *schedulercache.NodeInfo) (bool, []PredicateFailureReason, error)\n```\nFitPredicate is a function that indicates if a pod fits into an existing node. The failure information is given by the error.\n\n```go\ntype GetEquivalencePodFunc func(pod *v1.Pod) interface{}\n```\n\n```go\ntype MetadataProducer func(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}\n```\nMetadataProducer is a function that computes metadata for a given pod. This is now used for only for priority functions. For predicates please use PredicateMetadataProducer. TODO: Rename this once we have a specific type for priority metadata producer.\n\n```go\ntype NodeLister interface {\n\t// We explicitly return []*v1.Node, instead of v1.NodeList, to avoid\n\t// performing expensive copies that are unneeded.\n\tList() ([]*v1.Node, error)\n}\n```\nNodeLister interface represents anything that can list nodes for a scheduler.\n\n```go\ntype PodLister interface {\n\t// We explicitly return []*v1.Pod, instead of v1.PodList, to avoid\n\t// performing expensive copies that are unneeded.\n\tList(labels.Selector) ([]*v1.Pod, error)\n\t// This is similar to \"List()\", but the returned slice does not\n\t// contain pods that don't pass `podFilter`.\n\tFilteredList(podFilter schedulercache.PodFilter, selector labels.Selector) ([]*v1.Pod, error)\n}\n```\nPodLister interface represents anything that can list pods for a scheduler.\n\n```go\ntype PredicateFailureReason interface {\n\tGetReason() string\n}\n```\n\n```go\ntype PredicateMetadata interface {\n\tShallowCopy() PredicateMetadata\n\tAddPod(addedPod *v1.Pod, nodeInfo *schedulercache.NodeInfo) error\n\tRemovePod(deletedPod *v1.Pod) error\n}\n```\n\n```go\nfunc EmptyPredicateMetadataProducer(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) PredicateMetadata\n```\nEmptyPredicateMetadataProducer returns a no-op MetadataProducer type.\n\n```go\ntype PredicateMetadataProducer func(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) PredicateMetadata\n```\nPredicateMetadataProducer is a function that computes predicate metadata for a given pod.\n\n```go\ntype PriorityConfig struct {\n\tName   string\n\tMap    PriorityMapFunction\n\tReduce PriorityReduceFunction\n\t// TODO: Remove it after migrating all functions to\n\t// Map-Reduce pattern.\n\tFunction PriorityFunction\n\tWeight   int\n}\n```\n\n```go\ntype PriorityFunction func(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error)\n```\nDEPRECATED Use Map-Reduce pattern for priority functions.\n\n```go\ntype PriorityMapFunction func(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)\n```\nPriorityMapFunction is a function that computes per-node results for a given node. TODO: Figure out the exact API of this method. TODO: Change interface{} to a specific type.\n\n```go\ntype PriorityReduceFunction func(pod *v1.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error\n```\nPriorityReduceFunction is a function that aggregated per-node results and computes final scores for all nodes. TODO: Figure out the exact API of this method. TODO: Change interface{} to a specific type.\n\n```go\ntype ReplicaSetLister interface {\n\t// Gets the replicasets for the given pod\n\tGetPodReplicaSets(*v1.Pod) ([]*extensions.ReplicaSet, error)\n}\n```\nReplicaSetLister interface represents anything that can produce a list of ReplicaSet; the list is consumed by a scheduler.\n\n```go\ntype ScheduleAlgorithm interface {\n\tSchedule(*v1.Pod, NodeLister) (selectedMachine string, err error)\n\t// Preempt receives scheduling errors for a pod and tries to create room for\n\t// the pod by preempting lower priority pods if possible.\n\t// It returns the node where preemption happened, a list of preempted pods, a\n\t// list of pods whose nominated node name should be removed, and error if any.\n\tPreempt(*v1.Pod, NodeLister, error) (selectedNode *v1.Node, preemptedPods []*v1.Pod, cleanupNominatedPods []*v1.Pod, err error)\n\t// Predicates() returns a pointer to a map of predicate functions. This is\n\t// exposed for testing.\n\tPredicates() map[string]FitPredicate\n\t// Prioritizers returns a slice of priority config. This is exposed for\n\t// testing.\n\tPrioritizers() []PriorityConfig\n}\n```\nScheduleAlgorithm is an interface implemented by things that know how to schedule pods onto machines.\n\n```go\ntype SchedulerExtender interface {\n\t// Filter based on extender-implemented predicate functions. The filtered list is\n\t// expected to be a subset of the supplied list. failedNodesMap optionally contains\n\t// the list of failed nodes and failure reasons.\n\tFilter(pod *v1.Pod, nodes []*v1.Node, nodeNameToInfo map[string]*schedulercache.NodeInfo) (filteredNodes []*v1.Node, failedNodesMap schedulerapi.FailedNodesMap, err error)\n\n\t// Prioritize based on extender-implemented priority functions. The returned scores \u0026 weight\n\t// are used to compute the weighted score for an extender. The weighted scores are added to\n\t// the scores computed  by Kubernetes scheduler. The total scores are used to do the host selection.\n\tPrioritize(pod *v1.Pod, nodes []*v1.Node) (hostPriorities *schedulerapi.HostPriorityList, weight int, err error)\n\n\t// Bind delegates the action of binding a pod to a node to the extender.\n\tBind(binding *v1.Binding) error\n\n\t// IsBinder returns whether this extender is configured for the Bind method.\n\tIsBinder() bool\n}\n```\nSchedulerExtender is an interface for external processes to influence scheduling decisions made by Kubernetes. This is typically needed for resources not directly managed by Kubernetes.\n\n```go\ntype ServiceLister interface {\n\t// Lists all the services\n\tList(labels.Selector) ([]*v1.Service, error)\n\t// Gets the services for the given pod\n\tGetPodServices(*v1.Pod) ([]*v1.Service, error)\n}\n```\nServiceLister interface represents anything that can produce a list of services; the list is consumed by a scheduler.\n\n```go\ntype StatefulSetLister interface {\n\t// Gets the StatefulSet for the given pod.\n\tGetPodStatefulSets(*v1.Pod) ([]*apps.StatefulSet, error)\n}\n```\nStatefulSetLister interface represents anything that can produce a list of StatefulSet; the list is consumed by a scheduler.\n\n","path":"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/algorithm","name":"algorithm","synopsis":"Package scheduler contains a generic Scheduler interface and several implementations.","isRedistributable":true}
