Documentation
¶
Index ¶
- type Binder
- type Config
- type Configurator
- type FakeConfigurator
- func (fc *FakeConfigurator) Create() (*Config, error)
- func (fc *FakeConfigurator) CreateFromConfig(policy schedulerapi.Policy) (*Config, error)
- func (fc *FakeConfigurator) CreateFromKeys(predicateKeys, priorityKeys sets.String, ...) (*Config, error)
- func (fc *FakeConfigurator) CreateFromProvider(providerName string) (*Config, error)
- func (fc *FakeConfigurator) GetClient() clientset.Interface
- func (fc *FakeConfigurator) GetHardPodAffinitySymmetricWeight() int32
- func (fc *FakeConfigurator) GetNodeLister() corelisters.NodeLister
- func (fc *FakeConfigurator) GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error)
- func (fc *FakeConfigurator) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
- func (fc *FakeConfigurator) GetScheduledPodLister() corelisters.PodLister
- func (fc *FakeConfigurator) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error)
- type PodConditionUpdater
- type PodPreemptor
- type Scheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.10.8
type Config struct { // It is expected that changes made via SchedulerCache will be observed // by NodeLister and Algorithm. SchedulerCache schedulercache.Cache // Ecache is used for optimistically invalid affected cache items after // successfully binding a pod Ecache *equivalence.Cache NodeLister algorithm.NodeLister Algorithm algorithm.ScheduleAlgorithm GetBinder func(pod *v1.Pod) 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 PodConditionUpdater // PodPreemptor is used to evict pods and update pod annotations. PodPreemptor PodPreemptor // 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 record.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 }
Config is an implementation of the Scheduler's configured input data. TODO over time we should make this struct a hidden implementation detail of the scheduler.
type Configurator ¶ added in v1.10.8
type Configurator interface { // Exposed for testing GetHardPodAffinitySymmetricWeight() int32 // Exposed for testing MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error) // Predicate related accessors to be exposed for use by k8s.io/autoscaler/cluster-autoscaler GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error) // Needs to be exposed for things like integration tests where we want to make fake nodes. GetNodeLister() corelisters.NodeLister // Exposed for testing GetClient() clientset.Interface // Exposed for testing GetScheduledPodLister() corelisters.PodLister Create() (*Config, error) CreateFromProvider(providerName string) (*Config, error) CreateFromConfig(policy schedulerapi.Policy) (*Config, error) CreateFromKeys(predicateKeys, priorityKeys sets.String, extenders []algorithm.SchedulerExtender) (*Config, error) }
Configurator defines I/O, caching, and other functionality needed to construct a new scheduler. An implementation of this can be seen in factory.go.
type FakeConfigurator ¶ added in v1.10.8
type FakeConfigurator struct {
Config *Config
}
FakeConfigurator is an implementation for test.
func (*FakeConfigurator) Create ¶ added in v1.10.8
func (fc *FakeConfigurator) Create() (*Config, error)
Create returns FakeConfigurator.Config
func (*FakeConfigurator) CreateFromConfig ¶ added in v1.10.8
func (fc *FakeConfigurator) CreateFromConfig(policy schedulerapi.Policy) (*Config, error)
CreateFromConfig returns FakeConfigurator.Config
func (*FakeConfigurator) CreateFromKeys ¶ added in v1.10.8
func (fc *FakeConfigurator) CreateFromKeys(predicateKeys, priorityKeys sets.String, extenders []algorithm.SchedulerExtender) (*Config, error)
CreateFromKeys returns FakeConfigurator.Config
func (*FakeConfigurator) CreateFromProvider ¶ added in v1.10.8
func (fc *FakeConfigurator) CreateFromProvider(providerName string) (*Config, error)
CreateFromProvider returns FakeConfigurator.Config
func (*FakeConfigurator) GetClient ¶ added in v1.10.8
func (fc *FakeConfigurator) GetClient() clientset.Interface
GetClient is not implemented yet.
func (*FakeConfigurator) GetHardPodAffinitySymmetricWeight ¶ added in v1.10.8
func (fc *FakeConfigurator) GetHardPodAffinitySymmetricWeight() int32
GetHardPodAffinitySymmetricWeight is not implemented yet.
func (*FakeConfigurator) GetNodeLister ¶ added in v1.10.8
func (fc *FakeConfigurator) GetNodeLister() corelisters.NodeLister
GetNodeLister is not implemented yet.
func (*FakeConfigurator) GetPredicateMetadataProducer ¶ added in v1.10.8
func (fc *FakeConfigurator) GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error)
GetPredicateMetadataProducer is not implemented yet.
func (*FakeConfigurator) GetPredicates ¶ added in v1.10.8
func (fc *FakeConfigurator) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
GetPredicates is not implemented yet.
func (*FakeConfigurator) GetScheduledPodLister ¶ added in v1.10.8
func (fc *FakeConfigurator) GetScheduledPodLister() corelisters.PodLister
GetScheduledPodLister is not implemented yet.
func (*FakeConfigurator) MakeDefaultErrorFunc ¶ added in v1.10.8
func (fc *FakeConfigurator) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error)
MakeDefaultErrorFunc is not implemented yet.
type PodConditionUpdater ¶ added in v1.10.8
type PodConditionUpdater interface {
Update(pod *v1.Pod, podCondition *v1.PodCondition) error
}
PodConditionUpdater updates the condition of a pod based on the passed PodCondition
type PodPreemptor ¶ added in v1.10.8
type PodPreemptor interface { GetUpdatedPod(pod *v1.Pod) (*v1.Pod, error) DeletePod(pod *v1.Pod) error SetNominatedNodeName(pod *v1.Pod, nominatedNode string) error RemoveNominatedNodeName(pod *v1.Pod) error }
PodPreemptor has methods needed to delete a pod and to update annotations of the preemptor pod.
type Scheduler ¶
type Scheduler struct {
// 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 NewFromConfig ¶ added in v1.10.8
NewFromConfig returns a new scheduler using the provided Config.
func NewFromConfigurator ¶ added in v1.10.8
func NewFromConfigurator(c Configurator, modifiers ...func(c *Config)) (*Scheduler, error)
NewFromConfigurator returns a new scheduler that is created entirely by the Configurator. Assumes Create() is implemented. Supports intermediate Config mutation for now if you provide modifier functions which will run after Config is created.
func (*Scheduler) Cache ¶ added in v1.12.0
func (sched *Scheduler) Cache() schedulercache.Cache
Cache returns the cache in scheduler for test to check the data in scheduler.
func (*Scheduler) Config ¶ added in v1.10.8
Config return scheduler's config pointer. It is exposed for testing purposes.
func (*Scheduler) Run ¶ added in v1.10.8
func (sched *Scheduler) Run()
Run begins watching and scheduling. It waits for cache to be synced, then starts a goroutine and returns immediately.
func (*Scheduler) StopEverything ¶ added in v1.10.8
func (sched *Scheduler) StopEverything()
StopEverything closes the scheduler config's StopEverything channel, to shut down the Scheduler.
Directories
¶
Path | Synopsis |
---|---|
Package algorithm contains a generic Scheduler interface and several implementations.
|
Package algorithm contains a generic Scheduler interface and several implementations. |
Package api contains scheduler API objects.
|
Package api contains scheduler API objects. |
v1
Package v1 contains scheduler API objects.
|
Package v1 contains scheduler API objects. |
apis
|
|
equivalence
Package equivalence defines Pod equivalence classes and the equivalence class cache.
|
Package equivalence defines Pod equivalence classes and the equivalence class cache. |
Package factory can set up a scheduler.
|
Package factory can set up a scheduler. |