controller

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultScalerInterval = 97 * time.Millisecond

DefaultScalerInterval controls how often to run the scaling strategy. 97ms is chosen to avoid accidental locksteps with other systems such as OS schedulers or garbage collection.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	// Run requests that this controller starts doing its job, until an empty struct is sent on the close channel.
	Run(closeCh <-chan struct{})
	// SetScalerInterval changes the interval at which the controller recomputes the required number of replicas for functions.
	// Should not be called once running.
	SetScalingInterval(interval time.Duration)
}

Controller deploys functions by monitoring input lag to registered functions. To do so, it periodically runs some scaling logic and keeps track of (un-)registered functions, topics and deployments.

func New

func New(topicInformer informersV1.TopicInformer,
	functionInformer informersV1.FunctionInformer,
	deploymentInformer informersV1Beta1.DeploymentInformer,
	deployer Deployer,
	auto autoscaler.AutoScaler,
	port int) Controller

New initialises a new function controller, adding event handlers to the provided informers.

type Deployer

type Deployer interface {
	// Deploy requests that a function be initially deployed on k8s.
	Deploy(function *v1.Function) error

	// Undeploy is called when a function is unregistered.
	Undeploy(function *v1.Function) error

	// Update is called when a function is updated. The desired number of replicas of the function is provided.
	Update(function *v1.Function, replicas int) error

	// Scale is used to vary the number of replicas dedicated to a function, including going to zero.
	Scale(function *v1.Function, replicas int) error
}

Deployer allows the realisation of a function on k8s and its subsequent scaling to accommodate more/less load.

func NewDeployer

func NewDeployer(config *rest.Config, brokers []string) (Deployer, error)

Directories

Path Synopsis
mockautoscaler
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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