scheduler

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2015 License: Apache-2.0 Imports: 30 Imported by: 0

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

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 New

func New(config Config) *KubernetesScheduler

New create a new KubernetesScheduler

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 (*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 PluginConfig struct {
	*plugin.Config
	// contains filtered or unexported fields
}

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 Pod

type Pod struct {
	*api.Pod
	// contains filtered or unexported fields
}

wrapper for the k8s pod type so that we can define additional methods on a "pod"

func (*Pod) Breaker

func (p *Pod) Breaker() queue.BreakChan

func (*Pod) Copy

func (p *Pod) Copy() queue.Copyable

implements Copyable

func (*Pod) Deadline

func (dp *Pod) Deadline() (time.Time, bool)

implements Deadlined

func (*Pod) GetDelay

func (dp *Pod) GetDelay() time.Duration

func (*Pod) GetUID

func (p *Pod) GetUID() string

implements Unique

func (*Pod) String

func (p *Pod) String() string

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

type SchedulerFunc func(api.Pod, algorithm.MinionLister) (selectedMachine string, err error)

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 Slave

type Slave struct {
	HostName string
	Offers   map[string]empty
}

type SlaveIndex

type SlaveIndex interface {
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL