controller

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package controller contains all the controllers which taken together implement the deployment system's behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeStrategy

type ChangeStrategy interface {
	GenerateDeploymentConfig(namespace, name string) (*deployapi.DeploymentConfig, error)
	UpdateDeploymentConfig(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
}

ChangeStrategy knows how to generate and update DeploymentConfigs.

type DeploymentConfigChangeController

type DeploymentConfigChangeController struct {
	ChangeStrategy       ChangeStrategy
	NextDeploymentConfig func() *deployapi.DeploymentConfig
	DeploymentStore      cache.Store
	Codec                runtime.Codec
	// Stop is an optional channel that controls when the controller exits
	Stop <-chan struct{}
}

DeploymentConfigChangeController watches for changes to DeploymentConfigs and regenerates them only when detecting a change to the PodTemplate of a DeploymentConfig containing a ConfigChange trigger.

func (*DeploymentConfigChangeController) HandleDeploymentConfig

func (dc *DeploymentConfigChangeController) HandleDeploymentConfig()

HandleDeploymentConfig handles the next DeploymentConfig change that happens.

func (*DeploymentConfigChangeController) Run

Run watches for config change events.

type DeploymentConfigController

type DeploymentConfigController struct {
	// DeploymentInterface provides access to Deployments.
	DeploymentInterface dccDeploymentInterface
	// NextDeploymentConfig blocks until the next DeploymentConfig is available.
	NextDeploymentConfig func() *deployapi.DeploymentConfig
	// Codec is used to encode DeploymentConfigs which are stored on deployments.
	Codec runtime.Codec
	// Stop is an optional channel that controls when the controller exits.
	Stop <-chan struct{}
}

DeploymentConfigController is responsible for creating a deployment when a DeploymentConfig is updated with a new LatestVersion. Any deployment created is correlated to a DeploymentConfig by setting the DeploymentConfigLabel on the deployment.

Deployments are represented by ReplicationControllers. The DeploymentConfig used to create the ReplicationController is encoded and stored in an annotation on the ReplicationController.

func (*DeploymentConfigController) HandleDeploymentConfig

func (c *DeploymentConfigController) HandleDeploymentConfig()

Process a single DeploymentConfig event.

func (*DeploymentConfigController) Run

func (c *DeploymentConfigController) Run()

Process DeploymentConfig events one at a time.

type DeploymentContainerCreator

type DeploymentContainerCreator interface {
	CreateContainer(*deployapi.DeploymentStrategy) *kapi.Container
}

DeploymentContainerCreator knows how to create a deployment pod's container based on the deployment's strategy.

type DeploymentController

type DeploymentController struct {
	// ContainerCreator makes the container for the deployment pod based on the strategy.
	ContainerCreator DeploymentContainerCreator
	// DeploymentInterface provides access to deployments.
	DeploymentInterface dcDeploymentInterface
	// PodInterface provides access to pods.
	PodInterface dcPodInterface
	// NextDeployment blocks until the next deployment is available.
	NextDeployment func() *kapi.ReplicationController
	// NextPod blocks until the next pod is available.
	NextPod func() *kapi.Pod
	// DeploymentStore is a cache of deployments.
	DeploymentStore cache.Store
	// Environment is a set of environment which should be injected into all deployment pod
	// containers, in addition to whatever environment is specified by the ContainerCreator.
	Environment []kapi.EnvVar
	// UseLocalImages configures the ImagePullPolicy for containers in the deployment pod.
	UseLocalImages bool
	// Codec is used to decode DeploymentConfigs.
	Codec runtime.Codec
	// Stop is an optional channel that controls when the controller exits.
	Stop <-chan struct{}
}

DeploymentController performs a deployment by creating a pod which is defined by a strategy. The status of the resulting deployment will follow the status of the corresponding pod.

Deployments are represented by a ReplicationController.

func (*DeploymentController) HandleDeployment

func (dc *DeploymentController) HandleDeployment()

HandleDeployment processes a new deployment and creates a new Pod which implements the specific deployment behavior. The deployment and pod are correlated with annotations. If the pod was successfully created, the deployment's status is transitioned to pending; otherwise, the status is transitioned to failed.

func (*DeploymentController) HandlePod

func (dc *DeploymentController) HandlePod()

HandlePod reconciles a pod's current state with its associated deployment and updates the deployment appropriately.

func (*DeploymentController) Run

func (dc *DeploymentController) Run()

Run begins watching and synchronizing deployment states.

type ImageChangeController

type ImageChangeController struct {
	DeploymentConfigInterface icDeploymentConfigInterface
	NextImageRepository       func() *imageapi.ImageRepository
	DeploymentConfigStore     cache.Store
	// Stop is an optional channel that controls when the controller exits
	Stop <-chan struct{}
}

ImageChangeController watches for changes to ImageRepositories and regenerates DeploymentConfigs when a new version of a tag referenced by a DeploymentConfig is available.

func (*ImageChangeController) HandleImageRepo

func (c *ImageChangeController) HandleImageRepo()

HandleImageRepo processes the next ImageRepository event.

func (*ImageChangeController) Run

func (c *ImageChangeController) Run()

Run processes ImageRepository events one by one.

Directories

Path Synopsis
Package factory contains code used to create deployment controllers.
Package factory contains code used to create deployment controllers.

Jump to

Keyboard shortcuts

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