package scheduler
import "k8s.io/kubernetes/pkg/scheduler"
Index ¶
- Constants
- Variables
- func Equal(e1, e2 *HTTPExtender) bool
- func MakeDefaultErrorFunc(client clientset.Interface, podLister corelisters.PodLister, podQueue internalqueue.SchedulingQueue, schedulerCache internalcache.Cache) func(*framework.QueuedPodInfo, error)
- func NewHTTPExtender(config *schedulerapi.Extender) (framework.Extender, error)
- func NewInformerFactory(cs clientset.Interface, resyncPeriod time.Duration) informers.SharedInformerFactory
- type Binder
- type Configurator
- type FrameworkCapturer
- type HTTPExtender
- func (h *HTTPExtender) Bind(binding *v1.Binding) error
- func (h *HTTPExtender) Filter( pod *v1.Pod, nodes []*v1.Node, ) (filteredList []*v1.Node, failedNodes, failedAndUnresolvableNodes extenderv1.FailedNodesMap, err error)
- func (h *HTTPExtender) IsBinder() bool
- func (h *HTTPExtender) IsIgnorable() bool
- func (h *HTTPExtender) IsInterested(pod *v1.Pod) bool
- func (h *HTTPExtender) Name() string
- func (h *HTTPExtender) Prioritize(pod *v1.Pod, nodes []*v1.Node) (*extenderv1.HostPriorityList, int64, error)
- func (h *HTTPExtender) ProcessPreemption( pod *v1.Pod, nodeNameToVictims map[string]*extenderv1.Victims, nodeInfos framework.NodeInfoLister, ) (map[string]*extenderv1.Victims, error)
- func (h *HTTPExtender) SupportsPreemption() bool
- type Option
- func WithBuildFrameworkCapturer(fc FrameworkCapturer) Option
- func WithComponentConfigVersion(apiVersion string) Option
- func WithExtenders(e ...schedulerapi.Extender) Option
- func WithFrameworkOutOfTreeRegistry(registry frameworkruntime.Registry) Option
- func WithKubeConfig(cfg *restclient.Config) Option
- func WithParallelism(threads int32) Option
- func WithPercentageOfNodesToScore(percentageOfNodesToScore int32) Option
- func WithPodInitialBackoffSeconds(podInitialBackoffSeconds int64) Option
- func WithPodMaxBackoffSeconds(podMaxBackoffSeconds int64) Option
- func WithProfiles(p ...schedulerapi.KubeSchedulerProfile) Option
- type ScheduleAlgorithm
- type ScheduleResult
- type Scheduler
- func New(client clientset.Interface, informerFactory informers.SharedInformerFactory, dynInformerFactory dynamicinformer.DynamicSharedInformerFactory, recorderFactory profile.RecorderFactory, stopCh <-chan struct{}, opts ...Option) (*Scheduler, error)
- func (sched *Scheduler) Run(ctx context.Context)
Constants ¶
const ( // DefaultExtenderTimeout defines the default extender timeout in second. DefaultExtenderTimeout = 5 * time.Second )
const ( // SchedulerError is the reason recorded for events when an error occurs during scheduling a pod. SchedulerError = "SchedulerError" )
Variables ¶
ErrNoNodesAvailable is used to describe the error that no nodes available to schedule pods.
Functions ¶
func Equal ¶
func Equal(e1, e2 *HTTPExtender) bool
Equal is used to check if two extenders are equal ignoring the client field, exported for testing
func MakeDefaultErrorFunc ¶
func MakeDefaultErrorFunc(client clientset.Interface, podLister corelisters.PodLister, podQueue internalqueue.SchedulingQueue, schedulerCache internalcache.Cache) func(*framework.QueuedPodInfo, error)
MakeDefaultErrorFunc construct a function to handle pod scheduler error
func NewHTTPExtender ¶
func NewHTTPExtender(config *schedulerapi.Extender) (framework.Extender, error)
NewHTTPExtender creates an HTTPExtender object.
func NewInformerFactory ¶
func NewInformerFactory(cs clientset.Interface, resyncPeriod time.Duration) informers.SharedInformerFactory
NewInformerFactory creates a SharedInformerFactory and initializes a scheduler specific in-place podInformer.
Types ¶
type Binder ¶
Binder knows how to write a binding.
type Configurator ¶
type Configurator struct { // Close this to stop all reflectors StopEverything <-chan struct{} // contains filtered or unexported fields }
Configurator defines I/O, caching, and other functionality needed to construct a new scheduler.
type FrameworkCapturer ¶
type FrameworkCapturer func(schedulerapi.KubeSchedulerProfile)
FrameworkCapturer is used for registering a notify function in building framework.
type HTTPExtender ¶
type HTTPExtender struct {
// contains filtered or unexported fields
}
HTTPExtender implements the Extender interface.
func (*HTTPExtender) Bind ¶
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 ¶
func (h *HTTPExtender) Filter( pod *v1.Pod, nodes []*v1.Node, ) (filteredList []*v1.Node, failedNodes, failedAndUnresolvableNodes extenderv1.FailedNodesMap, err 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. The failedNodes and failedAndUnresolvableNodes optionally contains the list of failed nodes and failure reasons, except nodes in the latter are unresolvable.
func (*HTTPExtender) IsBinder ¶
func (h *HTTPExtender) IsBinder() bool
IsBinder returns whether this extender is configured for the Bind method.
func (*HTTPExtender) IsIgnorable ¶
func (h *HTTPExtender) IsIgnorable() bool
IsIgnorable returns true indicates scheduling should not fail when this extender is unavailable
func (*HTTPExtender) IsInterested ¶
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 ¶
func (h *HTTPExtender) Name() string
Name returns extenderURL to identify the extender.
func (*HTTPExtender) Prioritize ¶
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 ¶
func (h *HTTPExtender) ProcessPreemption( pod *v1.Pod, nodeNameToVictims map[string]*extenderv1.Victims, nodeInfos framework.NodeInfoLister, ) (map[string]*extenderv1.Victims, error)
ProcessPreemption returns filtered candidate nodes and victims after running preemption logic in extender.
func (*HTTPExtender) SupportsPreemption ¶
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 Option ¶
type Option func(*schedulerOptions)
Option configures a Scheduler
func WithBuildFrameworkCapturer ¶
func WithBuildFrameworkCapturer(fc FrameworkCapturer) Option
WithBuildFrameworkCapturer sets a notify function for getting buildFramework details.
func WithComponentConfigVersion ¶
WithComponentConfigVersion sets the component config version to the KubeSchedulerConfiguration version used. The string should be the full scheme group/version of the external type we converted from (for example "kubescheduler.config.k8s.io/v1beta2")
func WithExtenders ¶
func WithExtenders(e ...schedulerapi.Extender) Option
WithExtenders sets extenders for the Scheduler
func WithFrameworkOutOfTreeRegistry ¶
func WithFrameworkOutOfTreeRegistry(registry frameworkruntime.Registry) Option
WithFrameworkOutOfTreeRegistry sets the registry for out-of-tree plugins. Those plugins will be appended to the default registry.
func WithKubeConfig ¶
func WithKubeConfig(cfg *restclient.Config) Option
WithKubeConfig sets the kube config for Scheduler.
func WithParallelism ¶
WithParallelism sets the parallelism for all scheduler algorithms. Default is 16.
func WithPercentageOfNodesToScore ¶
WithPercentageOfNodesToScore sets percentageOfNodesToScore for Scheduler, the default value is 50
func WithPodInitialBackoffSeconds ¶
WithPodInitialBackoffSeconds sets podInitialBackoffSeconds for Scheduler, the default value is 1
func WithPodMaxBackoffSeconds ¶
WithPodMaxBackoffSeconds sets podMaxBackoffSeconds for Scheduler, the default value is 10
func WithProfiles ¶
func WithProfiles(p ...schedulerapi.KubeSchedulerProfile) Option
WithProfiles sets profiles for Scheduler. By default, there is one profile with the name "default-scheduler".
type ScheduleAlgorithm ¶
type ScheduleAlgorithm interface { Schedule(context.Context, []framework.Extender, framework.Framework, *framework.CycleState, *v1.Pod) (scheduleResult ScheduleResult, err error) }
ScheduleAlgorithm is an interface implemented by things that know how to schedule pods onto machines. TODO: Rename this type.
func NewGenericScheduler ¶
func NewGenericScheduler( cache internalcache.Cache, nodeInfoSnapshot *internalcache.Snapshot, percentageOfNodesToScore int32) ScheduleAlgorithm
NewGenericScheduler creates a genericScheduler object.
type ScheduleResult ¶
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 Scheduler ¶
type Scheduler struct { // It is expected that changes made via SchedulerCache will be observed // by NodeLister and Algorithm. SchedulerCache internalcache.Cache Algorithm ScheduleAlgorithm Extenders []framework.Extender // NextPod should be a function that blocks until the next pod // is available. We don't use a channel for this, because scheduling // a pod may take some amount of time and we don't want pods to get // stale while they sit in a channel. NextPod func() *framework.QueuedPodInfo // Error is called if there is an error. It is passed the pod in // question, and the error Error func(*framework.QueuedPodInfo, error) // Close this to shut down the scheduler. StopEverything <-chan struct{} // SchedulingQueue holds pods to be scheduled SchedulingQueue internalqueue.SchedulingQueue // Profiles are the scheduling profiles. Profiles profile.Map // contains filtered or unexported fields }
Scheduler watches for new unscheduled pods. It attempts to find nodes that they fit on and writes bindings back to the api server.
func New ¶
func New(client clientset.Interface, informerFactory informers.SharedInformerFactory, dynInformerFactory dynamicinformer.DynamicSharedInformerFactory, recorderFactory profile.RecorderFactory, stopCh <-chan struct{}, opts ...Option) (*Scheduler, error)
New returns a Scheduler
func (*Scheduler) Run ¶
Run begins watching and scheduling. It starts scheduling and blocked until the context is done.
Source Files ¶
eventhandlers.go extender.go factory.go generic_scheduler.go scheduler.go
Directories ¶
- Version
- v1.23.14
- Published
- Nov 9, 2022
- Platform
- js/wasm
- Imports
- 54 packages
- Last checked
- 12 seconds ago –
Tools for package owners.