Documentation ¶
Overview ¶
copied from k8s: plugin/pkg/scheduler/factory/factory.go
Package framework includes a kubernetes framework. that implements the interfaces of:
1: The mesos scheduler.
2: The kubernetes scheduler.
3: The kubernetes pod registry.
It acts as the 'scheduler' and the 'registry' of the PodRegistryStorage to provide scheduling and Pod management on top of mesos.
Index ¶
- func FCFSScheduleFunc(r offers.Registry, unused SlaveIndex, task *podtask.T) (offers.Perishable, error)
- type Config
- type KubernetesScheduler
- func (k *KubernetesScheduler) Disconnected(driver bindings.SchedulerDriver)
- func (k *KubernetesScheduler) Error(driver bindings.SchedulerDriver, message string)
- func (k *KubernetesScheduler) ExecutorLost(driver bindings.SchedulerDriver, executorId *mesos.ExecutorID, ...)
- func (k *KubernetesScheduler) FrameworkMessage(driver bindings.SchedulerDriver, executorId *mesos.ExecutorID, ...)
- func (k *KubernetesScheduler) Init(d bindings.SchedulerDriver, pl PluginInterface) error
- func (k *KubernetesScheduler) NewPluginConfig(startLatch <-chan struct{}) *PluginConfig
- func (k *KubernetesScheduler) OfferRescinded(driver bindings.SchedulerDriver, offerId *mesos.OfferID)
- func (k *KubernetesScheduler) Registered(driver bindings.SchedulerDriver, frameworkId *mesos.FrameworkID, ...)
- func (k *KubernetesScheduler) Reregistered(driver bindings.SchedulerDriver, masterInfo *mesos.MasterInfo)
- func (k *KubernetesScheduler) ResourceOffers(driver bindings.SchedulerDriver, offers []*mesos.Offer)
- func (k *KubernetesScheduler) SlaveLost(driver bindings.SchedulerDriver, slaveId *mesos.SlaveID)
- func (k *KubernetesScheduler) StatusUpdate(driver bindings.SchedulerDriver, taskStatus *mesos.TaskStatus)
- type PluginConfig
- type PluginInterface
- type Pod
- type PodScheduleFunc
- type Reconciler
- type SchedulerFunc
- type SchedulerInterface
- type Slave
- type SlaveIndex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FCFSScheduleFunc ¶
func FCFSScheduleFunc(r offers.Registry, unused SlaveIndex, task *podtask.T) (offers.Perishable, error)
A first-come-first-serve scheduler: acquires the first offer that can support the task
Types ¶
type Config ¶
type Config struct { Executor *mesos.ExecutorInfo ScheduleFunc PodScheduleFunc Client *client.Client EtcdClient tools.EtcdClient FailoverTimeout float64 ReconcileInterval int64 }
type KubernetesScheduler ¶
type KubernetesScheduler struct { // We use a lock here to avoid races // between invoking the mesos callback // and the invoking the pod registry interfaces. // In particular, changes to podtask.T objects are currently guarded by this lock. *sync.RWMutex // contains filtered or unexported fields }
KubernetesScheduler implements: 1: A mesos scheduler. 2: A kubernetes scheduler plugin. 3: A kubernetes pod.Registry.
func (*KubernetesScheduler) Disconnected ¶
func (k *KubernetesScheduler) Disconnected(driver bindings.SchedulerDriver)
Disconnected is called when the scheduler loses connection to the master.
func (*KubernetesScheduler) Error ¶
func (k *KubernetesScheduler) Error(driver bindings.SchedulerDriver, message string)
Error is called when there is an unrecoverable error in the scheduler or scheduler driver. The driver should have been aborted before this is invoked.
func (*KubernetesScheduler) ExecutorLost ¶
func (k *KubernetesScheduler) ExecutorLost(driver bindings.SchedulerDriver, executorId *mesos.ExecutorID, slaveId *mesos.SlaveID, status int)
ExecutorLost is called when some executor is lost.
func (*KubernetesScheduler) FrameworkMessage ¶
func (k *KubernetesScheduler) FrameworkMessage(driver bindings.SchedulerDriver, executorId *mesos.ExecutorID, slaveId *mesos.SlaveID, message string)
FrameworkMessage is called when the scheduler receives a message from the executor.
func (*KubernetesScheduler) Init ¶
func (k *KubernetesScheduler) Init(d bindings.SchedulerDriver, pl PluginInterface) error
func (*KubernetesScheduler) NewPluginConfig ¶
func (k *KubernetesScheduler) NewPluginConfig(startLatch <-chan struct{}) *PluginConfig
Create creates a scheduler plugin and all supporting background functions.
func (*KubernetesScheduler) OfferRescinded ¶
func (k *KubernetesScheduler) OfferRescinded(driver bindings.SchedulerDriver, offerId *mesos.OfferID)
OfferRescinded is called when the resources are recinded from the scheduler.
func (*KubernetesScheduler) Registered ¶
func (k *KubernetesScheduler) Registered(driver bindings.SchedulerDriver, frameworkId *mesos.FrameworkID, masterInfo *mesos.MasterInfo)
Registered is called when the scheduler registered with the master successfully.
func (*KubernetesScheduler) Reregistered ¶
func (k *KubernetesScheduler) Reregistered(driver bindings.SchedulerDriver, masterInfo *mesos.MasterInfo)
Reregistered is called when the scheduler re-registered with the master successfully. This happends when the master fails over.
func (*KubernetesScheduler) ResourceOffers ¶
func (k *KubernetesScheduler) ResourceOffers(driver bindings.SchedulerDriver, offers []*mesos.Offer)
ResourceOffers is called when the scheduler receives some offers from the master.
func (*KubernetesScheduler) SlaveLost ¶
func (k *KubernetesScheduler) SlaveLost(driver bindings.SchedulerDriver, slaveId *mesos.SlaveID)
SlaveLost is called when some slave is lost.
func (*KubernetesScheduler) StatusUpdate ¶
func (k *KubernetesScheduler) StatusUpdate(driver bindings.SchedulerDriver, taskStatus *mesos.TaskStatus)
StatusUpdate is called when a status update message is sent to the scheduler.
type PluginConfig ¶
type PluginInterface ¶
type PluginInterface interface { // execute the Scheduling plugin, should start a go routine and return immediately Run() // contains filtered or unexported methods }
func NewPlugin ¶
func NewPlugin(c *PluginConfig) PluginInterface
type PodScheduleFunc ¶
type PodScheduleFunc func(r offers.Registry, slaves SlaveIndex, task *podtask.T) (offers.Perishable, error)
PodScheduleFunc implements how to schedule pods among slaves. We can have different implementation for different scheduling policy.
The Schedule function accepts a group of slaves (each contains offers from that slave) and a single pod, which aligns well with the k8s scheduling algorithm. It returns an offerId that is acceptable for the pod, otherwise nil. The caller is responsible for filling in task state w/ relevant offer details.
See the FCFSScheduleFunc for example.
type Reconciler ¶
type Reconciler struct { Action func(driver bindings.SchedulerDriver, cancel <-chan struct{}) error // contains filtered or unexported fields }
func (*Reconciler) RequestExplicit ¶
func (r *Reconciler) RequestExplicit()
func (*Reconciler) RequestImplicit ¶
func (r *Reconciler) RequestImplicit()
func (*Reconciler) Run ¶
func (r *Reconciler) Run(driver bindings.SchedulerDriver)
execute task reconciliation, returns when r.done is closed. intended to run as a goroutine. if reconciliation is requested while another is in progress, the in-progress operation will be cancelled before the new reconciliation operation begins.
type SchedulerFunc ¶
adapter for k8s pkg/scheduler/Scheduler interface
func (SchedulerFunc) Schedule ¶
func (f SchedulerFunc) Schedule(pod api.Pod, lister algorithm.MinionLister) (string, error)
type SchedulerInterface ¶
type SchedulerInterface interface { sync.Locker RLocker() sync.Locker SlaveIndex // contains filtered or unexported methods }
scheduler abstraction to allow for easier unit testing
type SlaveIndex ¶
type SlaveIndex interface {
// contains filtered or unexported methods
}