scheduler

package
v1.2.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2015 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package scheduler implements the Kubernetes Mesos scheduler.

Index

Constants

View Source
const (
	FailedScheduling = "FailedScheduling"
	Scheduled        = "Scheduled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocationStrategy added in v1.1.6

type AllocationStrategy interface {
	// FitPredicate returns the selector used to determine pod fitness w/ respect to a given offer
	FitPredicate() podtask.FitPredicate

	// Procurement returns a func that obtains resources for a task from resource offer
	Procurement() podtask.Procurement
}

func NewAllocationStrategy added in v1.1.6

func NewAllocationStrategy(fitPredicate podtask.FitPredicate, procurement podtask.Procurement) AllocationStrategy

type Config

type Config struct {
	Schedcfg          schedcfg.Config
	Executor          *mesos.ExecutorInfo
	Scheduler         PodScheduler
	Client            *client.Client
	EtcdClient        tools.EtcdClient
	FailoverTimeout   float64
	ReconcileInterval int64
	ReconcileCooldown time.Duration
	LookupNode        node.LookupFunc
}

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
	PodScheduler
	// 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 creates 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 (k *KubernetesScheduler) Init(electedMaster proc.Process, pl PluginInterface, mux *http.ServeMux) error

func (*KubernetesScheduler) InstallDebugHandlers

func (k *KubernetesScheduler) InstallDebugHandlers(mux *http.ServeMux)

func (*KubernetesScheduler) NewDefaultPluginConfig

func (k *KubernetesScheduler) NewDefaultPluginConfig(terminate <-chan struct{}, mux *http.ServeMux) *PluginConfig

Create creates a scheduler plugin and all supporting background functions.

func (*KubernetesScheduler) NewPluginConfig

func (k *KubernetesScheduler) NewPluginConfig(terminate <-chan struct{}, mux *http.ServeMux,
	podsWatcher *cache.ListWatch) *PluginConfig

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

Registered is called when the scheduler registered with the master successfully.

func (*KubernetesScheduler) Registration

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 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(<-chan struct{})
	// 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 PodScheduler added in v1.1.6

type PodScheduler interface {
	AllocationStrategy

	// SchedulePod implements how to schedule pods among slaves.
	// We can have different implementation for different scheduling policy.
	//
	// The 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 FCFSPodScheduler for example.
	SchedulePod(r offers.Registry, slaves SlaveIndex, task *podtask.T) (offers.Perishable, error)
}

func NewFCFSPodScheduler added in v1.1.6

func NewFCFSPodScheduler(as AllocationStrategy, lookupNode node.LookupFunc) PodScheduler

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

type ReconcilerAction func(driver bindings.SchedulerDriver, cancel <-chan struct{}) <-chan error

type SlaveIndex

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

Directories

Path Synopsis
Package config provides mechanisms for low-level scheduler tuning.
Package config provides mechanisms for low-level scheduler tuning.
Package constraint exposes Marathon-like constraints for scheduling pods.
Package constraint exposes Marathon-like constraints for scheduling pods.
Package ha encapsulates high-availability scheduler concerns.
Package ha encapsulates high-availability scheduler concerns.
Package meta defines framework constants used as keys in k8s annotations that are attached to k8s pods.
Package meta defines framework constants used as keys in k8s annotations that are attached to k8s pods.
Package metrics defines and exposes instrumentation metrics of the scheduler.
Package metrics defines and exposes instrumentation metrics of the scheduler.
Package podtask maps Kubernetes pods to Mesos tasks.
Package podtask maps Kubernetes pods to Mesos tasks.
Package resource contains the Mesos scheduler specific resource functions
Package resource contains the Mesos scheduler specific resource functions
Package service contains the cmd/k8sm-scheduler glue code
Package service contains the cmd/k8sm-scheduler glue code
Package slave manages node hostnames for slave ids.
Package slave manages node hostnames for slave ids.
Package uid encapsulates unique identifiers code used by the scheduler.
Package uid encapsulates unique identifiers code used by the scheduler.

Jump to

Keyboard shortcuts

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