Documentation ¶
Overview ¶
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(electedMaster proc.Process, pl PluginInterface, mux *http.ServeMux) error
- func (k *KubernetesScheduler) InstallDebugHandlers(mux *http.ServeMux)
- func (k *KubernetesScheduler) NewPluginConfig(terminate <-chan struct{}, mux *http.ServeMux, ...) *PluginConfig
- func (k *KubernetesScheduler) OfferRescinded(driver bindings.SchedulerDriver, offerId *mesos.OfferID)
- func (k *KubernetesScheduler) Registered(drv bindings.SchedulerDriver, fid *mesos.FrameworkID, mi *mesos.MasterInfo)
- func (k *KubernetesScheduler) Registration() <-chan struct{}
- func (k *KubernetesScheduler) Reregistered(drv bindings.SchedulerDriver, mi *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 ReconcilerAction
- type SchedulerFunc
- 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 { Schedcfg schedcfg.Config Executor *mesos.ExecutorInfo ScheduleFunc PodScheduleFunc Client *client.Client EtcdClient tools.EtcdGetSet FailoverTimeout float64 ReconcileInterval int64 ReconcileCooldown time.Duration }
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(electedMaster proc.Process, pl PluginInterface, mux *http.ServeMux) error
func (*KubernetesScheduler) InstallDebugHandlers ¶ added in v0.5.0
func (k *KubernetesScheduler) InstallDebugHandlers(mux *http.ServeMux)
func (*KubernetesScheduler) NewPluginConfig ¶
func (k *KubernetesScheduler) NewPluginConfig(terminate <-chan struct{}, mux *http.ServeMux, makePodsWatcher func() *cache.ListWatch) *PluginConfig
Create 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(drv bindings.SchedulerDriver, fid *mesos.FrameworkID, mi *mesos.MasterInfo)
Registered is called when the scheduler registered with the master successfully.
func (*KubernetesScheduler) Registration ¶ added in v0.5.0
func (k *KubernetesScheduler) Registration() <-chan struct{}
func (*KubernetesScheduler) Reregistered ¶
func (k *KubernetesScheduler) Reregistered(drv bindings.SchedulerDriver, mi *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(<-chan struct{}) // 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 { proc.Doer Action ReconcilerAction // 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 ReconcilerAction ¶ added in v0.5.0
type ReconcilerAction func(driver bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error
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 SlaveIndex ¶
type SlaveIndex interface {
// contains filtered or unexported methods
}