package scheduler
import "k8s.io/kubernetes/pkg/scheduler"
Index ¶
- Constants
- func AddAllEventHandlers( sched *Scheduler, schedulerName string, nodeInformer coreinformers.NodeInformer, podInformer coreinformers.PodInformer, pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer, serviceInformer coreinformers.ServiceInformer, storageClassInformer storageinformersv1.StorageClassInformer, csiNodeInformer storageinformersv1beta1.CSINodeInformer, )
- type Option
- func WithBindTimeoutSeconds(bindTimeoutSeconds int64) Option
- func WithHardPodAffinitySymmetricWeight(hardPodAffinitySymmetricWeight int32) Option
- func WithName(schedulerName string) Option
- func WithPercentageOfNodesToScore(percentageOfNodesToScore int32) Option
- func WithPreemptionDisabled(disablePreemption bool) Option
- type Scheduler
- func New(client clientset.Interface, nodeInformer coreinformers.NodeInformer, podInformer coreinformers.PodInformer, pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer, replicationControllerInformer coreinformers.ReplicationControllerInformer, replicaSetInformer appsinformers.ReplicaSetInformer, statefulSetInformer appsinformers.StatefulSetInformer, serviceInformer coreinformers.ServiceInformer, pdbInformer policyinformers.PodDisruptionBudgetInformer, storageClassInformer storageinformersv1.StorageClassInformer, csiNodeInformer storageinformersv1beta1.CSINodeInformer, recorder events.EventRecorder, schedulerAlgorithmSource kubeschedulerconfig.SchedulerAlgorithmSource, stopCh <-chan struct{}, registry framework.Registry, plugins *kubeschedulerconfig.Plugins, pluginConfig []kubeschedulerconfig.PluginConfig, opts ...func(o *schedulerOptions)) (*Scheduler, error)
- func NewFromConfig(config *factory.Config) *Scheduler
- func (sched *Scheduler) Cache() internalcache.Cache
- func (sched *Scheduler) Run()
Constants ¶
const ( // BindTimeoutSeconds defines the default bind timeout BindTimeoutSeconds = 100 // SchedulerError is the reason recorded for events when an error occurs during scheduling a pod. SchedulerError = "SchedulerError" )
Functions ¶
func AddAllEventHandlers ¶
func AddAllEventHandlers( sched *Scheduler, schedulerName string, nodeInformer coreinformers.NodeInformer, podInformer coreinformers.PodInformer, pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer, serviceInformer coreinformers.ServiceInformer, storageClassInformer storageinformersv1.StorageClassInformer, csiNodeInformer storageinformersv1beta1.CSINodeInformer, )
AddAllEventHandlers is a helper function used in tests and in Scheduler to add event handlers for various informers.
Types ¶
type Option ¶
type Option func(*schedulerOptions)
Option configures a Scheduler
func WithBindTimeoutSeconds ¶
WithBindTimeoutSeconds sets bindTimeoutSeconds for Scheduler, the default value is 100
func WithHardPodAffinitySymmetricWeight ¶
WithHardPodAffinitySymmetricWeight sets hardPodAffinitySymmetricWeight for Scheduler, the default value is 1
func WithName ¶
WithName sets schedulerName for Scheduler, the default schedulerName is default-scheduler
func WithPercentageOfNodesToScore ¶
WithPercentageOfNodesToScore sets percentageOfNodesToScore for Scheduler, the default value is 50
func WithPreemptionDisabled ¶
WithPreemptionDisabled sets disablePreemption for Scheduler, the default value is false
type Scheduler ¶
type Scheduler struct { // It is expected that changes made via SchedulerCache will be observed // by NodeLister and Algorithm. SchedulerCache internalcache.Cache Algorithm core.ScheduleAlgorithm GetBinder func(pod *v1.Pod) factory.Binder // PodConditionUpdater is used only in case of scheduling errors. If we succeed // with scheduling, PodScheduled condition will be updated in apiserver in /bind // handler so that binding and setting PodCondition it is atomic. PodConditionUpdater factory.PodConditionUpdater // PodPreemptor is used to evict pods and update 'NominatedNode' field of // the preemptor pod. PodPreemptor factory.PodPreemptor // Framework runs scheduler plugins at configured extension points. Framework framework.Framework // 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() *v1.Pod // WaitForCacheSync waits for scheduler cache to populate. // It returns true if it was successful, false if the controller should shutdown. WaitForCacheSync func() bool // Error is called if there is an error. It is passed the pod in // question, and the error Error func(*v1.Pod, error) // Recorder is the EventRecorder to use Recorder events.EventRecorder // Close this to shut down the scheduler. StopEverything <-chan struct{} // VolumeBinder handles PVC/PV binding for the pod. VolumeBinder *volumebinder.VolumeBinder // Disable pod preemption or not. DisablePreemption bool // SchedulingQueue holds pods to be scheduled SchedulingQueue internalqueue.SchedulingQueue }
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, nodeInformer coreinformers.NodeInformer, podInformer coreinformers.PodInformer, pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer, replicationControllerInformer coreinformers.ReplicationControllerInformer, replicaSetInformer appsinformers.ReplicaSetInformer, statefulSetInformer appsinformers.StatefulSetInformer, serviceInformer coreinformers.ServiceInformer, pdbInformer policyinformers.PodDisruptionBudgetInformer, storageClassInformer storageinformersv1.StorageClassInformer, csiNodeInformer storageinformersv1beta1.CSINodeInformer, recorder events.EventRecorder, schedulerAlgorithmSource kubeschedulerconfig.SchedulerAlgorithmSource, stopCh <-chan struct{}, registry framework.Registry, plugins *kubeschedulerconfig.Plugins, pluginConfig []kubeschedulerconfig.PluginConfig, opts ...func(o *schedulerOptions)) (*Scheduler, error)
New returns a Scheduler
func NewFromConfig ¶
NewFromConfig returns a new scheduler using the provided Config.
func (*Scheduler) Cache ¶
func (sched *Scheduler) Cache() internalcache.Cache
Cache returns the cache in scheduler for test to check the data in scheduler.
func (*Scheduler) Run ¶
func (sched *Scheduler) Run()
Run begins watching and scheduling. It waits for cache to be synced, then starts a goroutine and returns immediately.
Source Files ¶
eventhandlers.go scheduler.go
Directories ¶
- Version
- v1.16.9
- Published
- Apr 16, 2020
- Platform
- js/wasm
- Imports
- 33 packages
- Last checked
- 45 minutes ago –
Tools for package owners.