controller

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2015 License: Apache-2.0 Imports: 9 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 added in v0.2.1

type ChangeStrategy interface {
	GetDeployment(namespace, name string) (*kapi.ReplicationController, error)
	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 ChangeStrategyImpl added in v0.3.2

type ChangeStrategyImpl struct {
	GetDeploymentFunc            func(namespace, name string) (*kapi.ReplicationController, error)
	GenerateDeploymentConfigFunc func(namespace, name string) (*deployapi.DeploymentConfig, error)
	UpdateDeploymentConfigFunc   func(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
}

ChangeStrategyImpl is a pluggable ChangeStrategy.

func (*ChangeStrategyImpl) GenerateDeploymentConfig added in v0.3.2

func (i *ChangeStrategyImpl) GenerateDeploymentConfig(namespace, name string) (*deployapi.DeploymentConfig, error)

func (*ChangeStrategyImpl) GetDeployment added in v0.3.2

func (i *ChangeStrategyImpl) GetDeployment(namespace, name string) (*kapi.ReplicationController, error)

func (*ChangeStrategyImpl) UpdateDeploymentConfig added in v0.3.2

func (i *ChangeStrategyImpl) UpdateDeploymentConfig(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)

type DeploymentConfigChangeController

type DeploymentConfigChangeController struct {
	ChangeStrategy       ChangeStrategy
	NextDeploymentConfig func() *deployapi.DeploymentConfig
	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(config *deployapi.DeploymentConfig) error

HandleDeploymentConfig handles the next DeploymentConfig change that happens.

func (*DeploymentConfigChangeController) Run

Run watches for config change events.

type DeploymentContainerCreator added in v0.2.1

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 DeploymentContainerCreatorImpl added in v0.3.2

type DeploymentContainerCreatorImpl struct {
	CreateContainerFunc func(*deployapi.DeploymentStrategy) *kapi.Container
}

DeploymentContainerCreatorImpl is a pluggable DeploymentContainerCreator.

func (*DeploymentContainerCreatorImpl) CreateContainer added in v0.3.2

type DeploymentController added in v0.2.1

type DeploymentController struct {
	// ContainerCreator makes the container for the deployment pod based on the strategy.
	ContainerCreator DeploymentContainerCreator
	// DeploymentClient provides access to deployments.
	DeploymentClient DeploymentControllerDeploymentClient
	// PodClient provides access to pods.
	PodClient DeploymentControllerPodClient
	// NextDeployment blocks until the next deployment is available.
	NextDeployment func() *kapi.ReplicationController
	// NextPod blocks until the next pod is available.
	NextPod func() *kapi.Pod
	// 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
	// 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 added in v0.2.1

func (dc *DeploymentController) HandleDeployment(deployment *kapi.ReplicationController) error

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.

func (*DeploymentController) HandlePod added in v0.2.1

func (dc *DeploymentController) HandlePod(pod *kapi.Pod) error

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

func (*DeploymentController) Run added in v0.2.1

func (dc *DeploymentController) Run()

Run begins watching and synchronizing deployment states.

type DeploymentControllerDeploymentClient added in v0.3.2

type DeploymentControllerDeploymentClient interface {
	GetDeployment(namespace, name string) (*kapi.ReplicationController, error)
	UpdateDeployment(namespace string, deployment *kapi.ReplicationController) (*kapi.ReplicationController, error)
}

DeploymentControllerDeploymentClient abstracts access to deployments.

type DeploymentControllerDeploymentClientImpl added in v0.3.2

type DeploymentControllerDeploymentClientImpl struct {
	GetDeploymentFunc    func(namespace, name string) (*kapi.ReplicationController, error)
	UpdateDeploymentFunc func(namespace string, deployment *kapi.ReplicationController) (*kapi.ReplicationController, error)
}

DeploymentControllerDeploymentClientImpl is a pluggable deploymentControllerDeploymentClient.

func (*DeploymentControllerDeploymentClientImpl) GetDeployment added in v0.3.2

func (i *DeploymentControllerDeploymentClientImpl) GetDeployment(namespace, name string) (*kapi.ReplicationController, error)

func (*DeploymentControllerDeploymentClientImpl) UpdateDeployment added in v0.3.2

type DeploymentControllerPodClient added in v0.3.2

type DeploymentControllerPodClient interface {
	CreatePod(namespace string, pod *kapi.Pod) (*kapi.Pod, error)
	DeletePod(namespace, name string) error
}

DeploymentControllerPodClient abstracts access to pods.

type DeploymentControllerPodClientImpl added in v0.3.2

type DeploymentControllerPodClientImpl struct {
	CreatePodFunc func(namespace string, pod *kapi.Pod) (*kapi.Pod, error)
	DeletePodFunc func(namespace, name string) error
}

deploymentControllerPodClientImpl is a pluggable deploymentControllerPodClient.

func (*DeploymentControllerPodClientImpl) CreatePod added in v0.3.2

func (i *DeploymentControllerPodClientImpl) CreatePod(namespace string, pod *kapi.Pod) (*kapi.Pod, error)

func (*DeploymentControllerPodClientImpl) DeletePod added in v0.3.2

func (i *DeploymentControllerPodClientImpl) DeletePod(namespace, name string) error

type ImageChangeController

type ImageChangeController struct {
	DeploymentConfigClient ImageChangeControllerDeploymentConfigClient
	NextImageRepository    func() *imageapi.ImageRepository
	// 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(imageRepo *imageapi.ImageRepository) error

HandleImageRepo processes the next ImageRepository event.

func (*ImageChangeController) Run

func (c *ImageChangeController) Run()

Run processes ImageRepository events one by one.

type ImageChangeControllerDeploymentConfigClient added in v0.3.2

type ImageChangeControllerDeploymentConfigClient interface {
	ListDeploymentConfigs() ([]*deployapi.DeploymentConfig, error)
	UpdateDeploymentConfig(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
	GenerateDeploymentConfig(namespace, name string) (*deployapi.DeploymentConfig, error)
}

ImageChangeControllerDeploymentConfigClient abstracts access to DeploymentConfigs.

type ImageChangeControllerDeploymentConfigClientImpl added in v0.3.2

type ImageChangeControllerDeploymentConfigClientImpl struct {
	ListDeploymentConfigsFunc    func() ([]*deployapi.DeploymentConfig, error)
	GenerateDeploymentConfigFunc func(namespace, name string) (*deployapi.DeploymentConfig, error)
	UpdateDeploymentConfigFunc   func(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
}

ImageChangeControllerDeploymentConfigClientImpl is a pluggable ChangeStrategy.

func (*ImageChangeControllerDeploymentConfigClientImpl) GenerateDeploymentConfig added in v0.3.2

func (i *ImageChangeControllerDeploymentConfigClientImpl) GenerateDeploymentConfig(namespace, name string) (*deployapi.DeploymentConfig, error)

func (*ImageChangeControllerDeploymentConfigClientImpl) ListDeploymentConfigs added in v0.3.2

func (*ImageChangeControllerDeploymentConfigClientImpl) UpdateDeploymentConfig added in v0.3.2

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