api

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRollingTimeoutSeconds is the default TimeoutSeconds for RollingDeploymentStrategyParams.
	DefaultRollingTimeoutSeconds int64 = 10 * 60
	// DefaultRollingIntervalSeconds is the default IntervalSeconds for RollingDeploymentStrategyParams.
	DefaultRollingIntervalSeconds int64 = 1
	// DefaultRollingUpdatePeriodSeconds is the default PeriodSeconds for RollingDeploymentStrategyParams.
	DefaultRollingUpdatePeriodSeconds int64 = 1
)
View Source
const (
	// DeploymentConfigAnnotation is an annotation name used to correlate a deployment with the
	// DeploymentConfig on which the deployment is based.
	DeploymentConfigAnnotation = "openshift.io/deployment-config.name"
	// DeploymentAnnotation is an annotation on a deployer Pod. The annotation value is the name
	// of the deployment (a ReplicationController) on which the deployer Pod acts.
	DeploymentAnnotation = "openshift.io/deployment.name"
	// DeploymentPodAnnotation is an annotation on a deployment (a ReplicationController). The
	// annotation value is the name of the deployer Pod which will act upon the ReplicationController
	// to implement the deployment behavior.
	DeploymentPodAnnotation = "openshift.io/deployer-pod.name"
	// DeployerPodForDeploymentLabel is a label which groups pods related to a
	// deployment. The value is a deployment name. The deployer pod and hook pods
	// created by the internal strategies will have this label. Custom
	// strategies can apply this label to any pods they create, enabling
	// platform-provided cancellation and garbage collection support.
	DeployerPodForDeploymentLabel = "openshift.io/deployer-pod-for.name"
	// DeploymentStatusAnnotation is an annotation name used to retrieve the DeploymentPhase of
	// a deployment.
	DeploymentStatusAnnotation = "openshift.io/deployment.phase"
	// DeploymentEncodedConfigAnnotation is an annotation name used to retrieve specific encoded
	// DeploymentConfig on which a given deployment is based.
	DeploymentEncodedConfigAnnotation = "openshift.io/encoded-deployment-config"
	// DeploymentVersionAnnotation is an annotation on a deployment (a ReplicationController). The
	// annotation value is the LatestVersion value of the DeploymentConfig which was the basis for
	// the deployment.
	DeploymentVersionAnnotation = "openshift.io/deployment-config.latest-version"
	// DeploymentLabel is the name of a label used to correlate a deployment with the Pod created
	// to execute the deployment logic.
	// TODO: This is a workaround for upstream's lack of annotation support on PodTemplate. Once
	// annotations are available on PodTemplate, audit this constant with the goal of removing it.
	DeploymentLabel = "deployment"
	// DeploymentConfigLabel is the name of a label used to correlate a deployment with the
	// DeploymentConfigs on which the deployment is based.
	DeploymentConfigLabel = "deploymentconfig"
	// DesiredReplicasAnnotation represents the desired number of replicas for a
	// new deployment.
	// TODO: This should be made public upstream.
	DesiredReplicasAnnotation = "kubectl.kubernetes.io/desired-replicas"
	// DeploymentStatusReasonAnnotation represents the reason for deployment being in a given state
	// Used for specifying the reason for cancellation or failure of a deployment
	DeploymentStatusReasonAnnotation = "openshift.io/deployment.status-reason"
	// DeploymentCancelledAnnotation indicates that the deployment has been cancelled
	// The annotation value does not matter and its mere presence indicates cancellation
	DeploymentCancelledAnnotation = "openshift.io/deployment.cancelled"
	// DeploymentReplicasAnnotation is for internal use only and is for
	// detecting external modifications to deployment replica counts.
	DeploymentReplicasAnnotation = "openshift.io/deployment.replicas"
	// PostHookPodSuffix is the suffix added to all pre hook pods
	PreHookPodSuffix = "hook-pre"
	// PostHookPodSuffix is the suffix added to all mid hook pods
	MidHookPodSuffix = "hook-mid"
	// PostHookPodSuffix is the suffix added to all post hook pods
	PostHookPodSuffix = "hook-post"
)

These constants represent keys used for correlating objects related to deployments.

View Source
const (
	DeploymentCancelledByUser                 = "The deployment was cancelled by the user"
	DeploymentCancelledNewerDeploymentExists  = "The deployment was cancelled as a newer deployment was found running"
	DeploymentFailedUnrelatedDeploymentExists = "The deployment failed as an unrelated pod with the same name as this deployment is already running"
	DeploymentFailedDeployerPodNoLongerExists = "The deployment failed as the deployer pod no longer exists"
)

These constants represent the various reasons for cancelling a deployment or for a deployment being placed in a failed state

View Source
const DeploymentCancelledAnnotationValue = "true"

DeploymentCancelledAnnotationValue represents the value for the DeploymentCancelledAnnotation annotation that signifies that the deployment should be cancelled

View Source
const GroupName = ""
View Source
const MaxDeploymentDurationSeconds int64 = 21600

MaxDeploymentDurationSeconds represents the maximum duration that a deployment is allowed to run This is set as the default value for ActiveDeadlineSeconds for the deployer pod Currently set to 6 hours

Variables

View Source
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}

SchemeGroupVersion is group version used to register these objects

Functions

func AddToScheme added in v1.1.3

func AddToScheme(scheme *runtime.Scheme)

func DeploymentConfigToSelectableFields added in v1.0.8

func DeploymentConfigToSelectableFields(deploymentConfig *DeploymentConfig) fields.Set

DeploymentConfigToSelectableFields returns a label set that represents the object

func DeploymentToPodLogOptions added in v1.0.8

func DeploymentToPodLogOptions(opts *DeploymentLogOptions) *kapi.PodLogOptions

DeploymentToPodLogOptions builds a PodLogOptions object out of a DeploymentLogOptions. Currently DeploymentLogOptions.Container and DeploymentLogOptions.Previous aren't used so they won't be copied to PodLogOptions.

Note that Previous for PodLogOptions is different from Previous for DeploymentLogOptions so it shouldn't be included here.

func EachTemplateImage added in v1.1.2

func EachTemplateImage(pod *kapi.PodSpec, triggerFn TriggeredByFunc, fn func(TemplateImage, error))

EachTemplateImage iterates a pod spec, looking for triggers that match each container and invoking fn with each located image.

func Kind added in v1.1.2

func Kind(kind string) unversioned.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource added in v1.1.2

func Resource(resource string) unversioned.GroupResource

Resource takes an unqualified resource and returns back a Group qualified GroupResource

func ScaleFromConfig added in v1.1.1

func ScaleFromConfig(dc *DeploymentConfig) *extensions.Scale

ScaleFromConfig builds a scale resource out of a deployment config.

Types

type CustomDeploymentStrategyParams added in v0.2.1

type CustomDeploymentStrategyParams struct {
	// Image specifies a Docker image which can carry out a deployment.
	Image string
	// Environment holds the environment which will be given to the container for Image.
	Environment []kapi.EnvVar
	// Command is optional and overrides CMD in the container Image.
	Command []string
}

CustomDeploymentStrategyParams are the input to the Custom deployment strategy.

type DeploymentCause

type DeploymentCause struct {
	// Type is the type of the trigger that resulted in the creation of a new deployment
	Type DeploymentTriggerType
	// ImageTrigger contains the image trigger details, if this trigger was fired based on an image change
	ImageTrigger *DeploymentCauseImageTrigger
}

DeploymentCause captures information about a particular cause of a deployment.

type DeploymentCauseImageTrigger

type DeploymentCauseImageTrigger struct {
	// From is a reference to the changed object which triggered a deployment. The field may have
	// the kinds DockerImage, ImageStreamTag, or ImageStreamImage.
	From kapi.ObjectReference
}

DeploymentCauseImageTrigger contains information about a deployment caused by an image trigger

type DeploymentConfig

type DeploymentConfig struct {
	unversioned.TypeMeta
	kapi.ObjectMeta

	// Spec represents a desired deployment state and how to deploy to it.
	Spec DeploymentConfigSpec

	// Status represents the current deployment state.
	Status DeploymentConfigStatus
}

DeploymentConfig represents a configuration for a single deployment (represented as a ReplicationController). It also contains details about changes which resulted in the current state of the DeploymentConfig. Each change to the DeploymentConfig which should result in a new deployment results in an increment of LatestVersion.

func (*DeploymentConfig) GetObjectKind added in v1.1.3

func (obj *DeploymentConfig) GetObjectKind() unversioned.ObjectKind

type DeploymentConfigList

type DeploymentConfigList struct {
	unversioned.TypeMeta
	unversioned.ListMeta

	// Items is a list of deployment configs
	Items []DeploymentConfig
}

DeploymentConfigList is a collection of deployment configs.

func (*DeploymentConfigList) GetObjectKind added in v1.1.3

func (obj *DeploymentConfigList) GetObjectKind() unversioned.ObjectKind

type DeploymentConfigRollback added in v0.2.1

type DeploymentConfigRollback struct {
	unversioned.TypeMeta
	// Spec defines the options to rollback generation.
	Spec DeploymentConfigRollbackSpec
}

DeploymentConfigRollback provides the input to rollback generation.

func (*DeploymentConfigRollback) GetObjectKind added in v1.1.3

func (obj *DeploymentConfigRollback) GetObjectKind() unversioned.ObjectKind

type DeploymentConfigRollbackSpec added in v0.2.1

type DeploymentConfigRollbackSpec struct {
	// From points to a ReplicationController which is a deployment.
	From kapi.ObjectReference
	// IncludeTriggers specifies whether to include config Triggers.
	IncludeTriggers bool
	// IncludeTemplate specifies whether to include the PodTemplateSpec.
	IncludeTemplate bool
	// IncludeReplicationMeta specifies whether to include the replica count and selector.
	IncludeReplicationMeta bool
	// IncludeStrategy specifies whether to include the deployment Strategy.
	IncludeStrategy bool
}

DeploymentConfigRollbackSpec represents the options for rollback generation.

type DeploymentConfigSpec added in v1.1.1

type DeploymentConfigSpec struct {
	// Strategy describes how a deployment is executed.
	Strategy DeploymentStrategy

	// Triggers determine how updates to a DeploymentConfig result in new deployments. If no triggers
	// are defined, a new deployment can only occur as a result of an explicit client update to the
	// DeploymentConfig with a new LatestVersion.
	Triggers []DeploymentTriggerPolicy

	// Replicas is the number of desired replicas.
	Replicas int

	// Test ensures that this deployment config will have zero replicas except while a deployment is running. This allows the
	// deployment config to be used as a continuous deployment test - triggering on images, running the deployment, and then succeeding
	// or failing. Post strategy hooks and After actions can be used to integrate successful deployment with an action.
	Test bool

	// Selector is a label query over pods that should match the Replicas count.
	Selector map[string]string

	// Template is the object that describes the pod that will be created if
	// insufficient replicas are detected.
	Template *kapi.PodTemplateSpec
}

DeploymentConfigSpec represents the desired state of the deployment.

type DeploymentConfigStatus added in v1.1.1

type DeploymentConfigStatus struct {
	// LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig
	// is out of sync.
	LatestVersion int
	// Details are the reasons for the update to this deployment config.
	// This could be based on a change made by the user or caused by an automatic trigger
	Details *DeploymentDetails
}

DeploymentConfigStatus represents the current deployment state.

type DeploymentDetails

type DeploymentDetails struct {
	// Message is the user specified change message, if this deployment was triggered manually by the user
	Message string
	// Causes are extended data associated with all the causes for creating a new deployment
	Causes []*DeploymentCause
}

DeploymentDetails captures information about the causes of a deployment.

type DeploymentLog added in v1.0.7

type DeploymentLog struct {
	unversioned.TypeMeta
}

DeploymentLog represents the logs for a deployment

func (*DeploymentLog) GetObjectKind added in v1.1.3

func (obj *DeploymentLog) GetObjectKind() unversioned.ObjectKind

type DeploymentLogOptions added in v1.0.7

type DeploymentLogOptions struct {
	unversioned.TypeMeta

	// Container for which to return logs
	Container string
	// Follow if true indicates that the deployment log should be streamed until
	// the deployment terminates.
	Follow bool
	// If true, return previous deployment logs
	Previous bool
	// A relative time in seconds before the current time from which to show logs. If this value
	// precedes the time a pod was started, only logs since the pod start will be returned.
	// If this value is in the future, no logs will be returned.
	// Only one of sinceSeconds or sinceTime may be specified.
	SinceSeconds *int64
	// An RFC3339 timestamp from which to show logs. If this value
	// preceeds the time a pod was started, only logs since the pod start will be returned.
	// If this value is in the future, no logs will be returned.
	// Only one of sinceSeconds or sinceTime may be specified.
	SinceTime *unversioned.Time
	// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
	// of log output.
	Timestamps bool
	// If set, the number of lines from the end of the logs to show. If not specified,
	// logs are shown from the creation of the container or sinceSeconds or sinceTime
	TailLines *int64
	// If set, the number of bytes to read from the server before terminating the
	// log output. This may not display a complete final line of logging, and may return
	// slightly more or slightly less than the specified limit.
	LimitBytes *int64

	// NoWait if true causes the call to return immediately even if the deployment
	// is not available yet. Otherwise the server will wait until the deployment has started.
	NoWait bool

	// Version of the deployment for which to view logs.
	Version *int64
}

DeploymentLogOptions is the REST options for a deployment log

func (*DeploymentLogOptions) GetObjectKind added in v1.1.3

func (obj *DeploymentLogOptions) GetObjectKind() unversioned.ObjectKind

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus describes the possible states a deployment can be in.

const (
	// DeploymentStatusNew means the deployment has been accepted but not yet acted upon.
	DeploymentStatusNew DeploymentStatus = "New"
	// DeploymentStatusPending means the deployment been handed over to a deployment strategy,
	// but the strategy has not yet declared the deployment to be running.
	DeploymentStatusPending DeploymentStatus = "Pending"
	// DeploymentStatusRunning means the deployment strategy has reported the deployment as
	// being in-progress.
	DeploymentStatusRunning DeploymentStatus = "Running"
	// DeploymentStatusComplete means the deployment finished without an error.
	DeploymentStatusComplete DeploymentStatus = "Complete"
	// DeploymentStatusFailed means the deployment finished with an error.
	DeploymentStatusFailed DeploymentStatus = "Failed"
)

type DeploymentStrategy

type DeploymentStrategy struct {
	// Type is the name of a deployment strategy.
	Type DeploymentStrategyType

	// CustomParams are the input to the Custom deployment strategy.
	CustomParams *CustomDeploymentStrategyParams
	// RecreateParams are the input to the Recreate deployment strategy.
	RecreateParams *RecreateDeploymentStrategyParams
	// RollingParams are the input to the Rolling deployment strategy.
	RollingParams *RollingDeploymentStrategyParams

	// Resources contains resource requirements to execute the deployment
	Resources kapi.ResourceRequirements
	// Labels is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.
	Labels map[string]string
	// Annotations is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.
	Annotations map[string]string
}

DeploymentStrategy describes how to perform a deployment.

type DeploymentStrategyType

type DeploymentStrategyType string

DeploymentStrategyType refers to a specific DeploymentStrategy implementation.

const (
	// DeploymentStrategyTypeRecreate is a simple strategy suitable as a default.
	DeploymentStrategyTypeRecreate DeploymentStrategyType = "Recreate"
	// DeploymentStrategyTypeCustom is a user defined strategy.
	DeploymentStrategyTypeCustom DeploymentStrategyType = "Custom"
	// DeploymentStrategyTypeRolling uses the Kubernetes RollingUpdater.
	DeploymentStrategyTypeRolling DeploymentStrategyType = "Rolling"
)

type DeploymentTriggerImageChangeParams

type DeploymentTriggerImageChangeParams struct {
	// Automatic means that the detection of a new tag value should result in a new deployment.
	Automatic bool
	// ContainerNames is used to restrict tag updates to the specified set of container names in a pod.
	ContainerNames []string
	// From is a reference to an image stream tag to watch for changes. From.Name is the only
	// required subfield - if From.Namespace is blank, the namespace of the current deployment
	// trigger will be used.
	From kapi.ObjectReference
	// LastTriggeredImage is the last image to be triggered.
	LastTriggeredImage string
}

DeploymentTriggerImageChangeParams represents the parameters to the ImageChange trigger.

type DeploymentTriggerPolicy

type DeploymentTriggerPolicy struct {
	// Type of the trigger
	Type DeploymentTriggerType
	// ImageChangeParams represents the parameters for the ImageChange trigger.
	ImageChangeParams *DeploymentTriggerImageChangeParams
}

DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.

type DeploymentTriggerType

type DeploymentTriggerType string

DeploymentTriggerType refers to a specific DeploymentTriggerPolicy implementation.

const (
	// DeploymentTriggerManual is a placeholder implementation which does nothing.
	DeploymentTriggerManual DeploymentTriggerType = "Manual"
	// DeploymentTriggerOnImageChange will create new deployments in response to updated tags from
	// a Docker image repository.
	DeploymentTriggerOnImageChange DeploymentTriggerType = "ImageChange"
	// DeploymentTriggerOnConfigChange will create new deployments in response to changes to
	// the ControllerTemplate of a DeploymentConfig.
	DeploymentTriggerOnConfigChange DeploymentTriggerType = "ConfigChange"
)

type ExecNewPodHook added in v0.4.4

type ExecNewPodHook struct {
	// Command is the action command and its arguments.
	Command []string
	// Env is a set of environment variables to supply to the hook pod's container.
	Env []kapi.EnvVar
	// ContainerName is the name of a container in the deployment pod template
	// whose Docker image will be used for the hook pod's container.
	ContainerName string
	// Volumes is a list of named volumes from the pod template which should be
	// copied to the hook pod.
	Volumes []string
}

ExecNewPodHook is a hook implementation which runs a command in a new pod based on the specified container which is assumed to be part of the deployment template.

type LifecycleHook added in v0.4.4

type LifecycleHook struct {
	// FailurePolicy specifies what action to take if the hook fails.
	FailurePolicy LifecycleHookFailurePolicy

	// ExecNewPod specifies the options for a lifecycle hook backed by a pod.
	ExecNewPod *ExecNewPodHook

	// TagImages instructs the deployer to tag the current image referenced under a container onto an image stream tag if the deployment succeeds.
	TagImages []TagImageHook
}

LifecycleHook defines a specific deployment lifecycle action. Only one type of action may be specified at any time.

type LifecycleHookFailurePolicy added in v0.4.4

type LifecycleHookFailurePolicy string

LifecycleHookFailurePolicy describes possibles actions to take if a hook fails.

const (
	// LifecycleHookFailurePolicyRetry means retry the hook until it succeeds.
	LifecycleHookFailurePolicyRetry LifecycleHookFailurePolicy = "Retry"
	// LifecycleHookFailurePolicyAbort means abort the deployment (if possible).
	LifecycleHookFailurePolicyAbort LifecycleHookFailurePolicy = "Abort"
	// LifecycleHookFailurePolicyIgnore means ignore failure and continue the deployment.
	LifecycleHookFailurePolicyIgnore LifecycleHookFailurePolicy = "Ignore"
)

type RecreateDeploymentStrategyParams added in v0.4.4

type RecreateDeploymentStrategyParams struct {
	// TimeoutSeconds is the time to wait for updates before giving up. If the
	// value is nil, a default will be used.
	TimeoutSeconds *int64
	// Pre is a lifecycle hook which is executed before the strategy manipulates
	// the deployment. All LifecycleHookFailurePolicy values are supported.
	Pre *LifecycleHook
	// Mid is a lifecycle hook which is executed while the deployment is scaled down to zero before the first new
	// pod is created. All LifecycleHookFailurePolicy values are supported.
	Mid *LifecycleHook
	// Post is a lifecycle hook which is executed after the strategy has
	// finished all deployment logic.
	Post *LifecycleHook
}

RecreateDeploymentStrategyParams are the input to the Recreate deployment strategy.

type RollingDeploymentStrategyParams added in v0.5.1

type RollingDeploymentStrategyParams struct {
	// UpdatePeriodSeconds is the time to wait between individual pod updates.
	// If the value is nil, a default will be used.
	UpdatePeriodSeconds *int64
	// IntervalSeconds is the time to wait between polling deployment status
	// after update. If the value is nil, a default will be used.
	IntervalSeconds *int64
	// TimeoutSeconds is the time to wait for updates before giving up. If the
	// value is nil, a default will be used.
	TimeoutSeconds *int64
	// The maximum number of pods that can be unavailable during the update.
	// Value can be an absolute number (ex: 5) or a percentage of total pods at the start of update (ex: 10%).
	// Absolute number is calculated from percentage by rounding up.
	// This can not be 0 if MaxSurge is 0.
	// By default, a fixed value of 1 is used.
	// Example: when this is set to 30%, the old RC can be scaled down by 30%
	// immediately when the rolling update starts. Once new pods are ready, old RC
	// can be scaled down further, followed by scaling up the new RC, ensuring
	// that at least 70% of original number of pods are available at all times
	// during the update.
	MaxUnavailable intstr.IntOrString
	// The maximum number of pods that can be scheduled above the original number of
	// pods.
	// Value can be an absolute number (ex: 5) or a percentage of total pods at
	// the start of the update (ex: 10%). This can not be 0 if MaxUnavailable is 0.
	// Absolute number is calculated from percentage by rounding up.
	// By default, a value of 1 is used.
	// Example: when this is set to 30%, the new RC can be scaled up by 30%
	// immediately when the rolling update starts. Once old pods have been killed,
	// new RC can be scaled up further, ensuring that total number of pods running
	// at any time during the update is atmost 130% of original pods.
	MaxSurge intstr.IntOrString
	// UpdatePercent is the percentage of replicas to scale up or down each
	// interval. If nil, one replica will be scaled up and down each interval.
	// If negative, the scale order will be down/up instead of up/down.
	// DEPRECATED: Use MaxUnavailable/MaxSurge instead.
	UpdatePercent *int
	// Pre is a lifecycle hook which is executed before the deployment process
	// begins. All LifecycleHookFailurePolicy values are supported.
	Pre *LifecycleHook
	// Post is a lifecycle hook which is executed after the strategy has
	// finished all deployment logic.
	Post *LifecycleHook
}

RollingDeploymentStrategyParams are the input to the Rolling deployment strategy.

type TagImageHook added in v1.1.3

type TagImageHook struct {
	// ContainerName is the name of a container in the deployment config whose image value will be used as the source of the tag
	ContainerName string
	// To is the target ImageStreamTag to set the image of
	To kapi.ObjectReference
}

TagImageHook is a request to tag the image in a particular container onto an ImageStreamTag.

type TemplateImage added in v1.1.2

type TemplateImage struct {
	Image string

	Ref *imageapi.DockerImageReference

	From *kapi.ObjectReference

	Container *kapi.Container
}

TemplateImage is a structure for helping a caller iterate over a PodSpec

func IgnoreTriggers added in v1.1.3

func IgnoreTriggers(container *kapi.Container) (TemplateImage, bool)

IgnoreTriggers ignores the triggers

func TemplateImageForContainer added in v1.1.2

func TemplateImageForContainer(pod *kapi.PodSpec, triggerFn TriggeredByFunc, containerName string) (TemplateImage, error)

TemplateImageForContainer locates the requested container in a pod spec, returning information about the trigger (if it exists), or an error.

type TriggeredByFunc added in v1.1.2

type TriggeredByFunc func(container *kapi.Container) (TemplateImage, bool)

TriggeredByFunc returns a TemplateImage or error from the provided container

func DeploymentConfigHasTrigger added in v1.1.2

func DeploymentConfigHasTrigger(config *DeploymentConfig) TriggeredByFunc

DeploymentConfigHasTrigger returns a function that can identify the image for each container.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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