util

package
v0.0.0-...-d3d374b Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Reasons for deployment config conditions:
	//
	// ReplicationControllerUpdatedReason is added in a deployment config when one of its replication
	// controllers is updated as part of the rollout process.
	ReplicationControllerUpdatedReason = "ReplicationControllerUpdated"
	// FailedRcCreateReason is added in a deployment config when it cannot create a new replication
	// controller.
	FailedRcCreateReason = "ReplicationControllerCreateError"
	// NewReplicationControllerReason is added in a deployment config when it creates a new replication
	// controller.
	NewReplicationControllerReason = "NewReplicationControllerCreated"
	// NewRcAvailableReason is added in a deployment config when its newest replication controller is made
	// available ie. the number of new pods that have passed readiness checks and run for at least
	// minReadySeconds is at least the minimum available pods that need to run for the deployment config.
	NewRcAvailableReason = "NewReplicationControllerAvailable"
	// TimedOutReason is added in a deployment config when its newest replication controller fails to show
	// any progress within the given deadline (progressDeadlineSeconds).
	TimedOutReason = "ProgressDeadlineExceeded"
	// PausedDeployReason is added in a deployment config when it is paused. Lack of progress shouldn't be
	// estimated once a deployment config is paused.
	PausedDeployReason = "DeploymentConfigPaused"
	// ResumedDeployReason is added in a deployment config when it is resumed. Useful for not failing accidentally
	// deployment configs that paused amidst a rollout.
	ResumedDeployReason = "DeploymentConfigResumed"
)
View Source
const DeployerPodSuffix = "deploy"

DeployerPodSuffix is the suffix added to pods created from a deployment

Variables

This section is empty.

Functions

func ActiveDeployment

func ActiveDeployment(input []api.ReplicationController) *api.ReplicationController

ActiveDeployment returns the latest complete deployment, or nil if there is no such deployment. The active deployment is not always the same as the latest deployment.

func AnyDeployerPodSelector

func AnyDeployerPodSelector() labels.Selector

AnyDeployerPodSelector returns a label Selector which can be used to find all deployer pods across all deployments, including hook and custom deployer pods.

func CanTransitionPhase

func CanTransitionPhase(current, next deployapi.DeploymentStatus) bool

CanTransitionPhase returns whether it is allowed to go from the current to the next phase.

func ConfigSelector

func ConfigSelector(name string) labels.Selector

ConfigSelector returns a label Selector which can be used to find all deployments for a DeploymentConfig.

TODO: Using the annotation constant for now since the value is correct but we could consider adding a new constant to the public types.

func DecodeDeploymentConfig

func DecodeDeploymentConfig(controller *api.ReplicationController, decoder runtime.Decoder) (*deployapi.DeploymentConfig, error)

DecodeDeploymentConfig decodes a DeploymentConfig from controller using codec. An error is returned if the controller doesn't contain an encoded config.

func DeployerPodNameFor

func DeployerPodNameFor(obj runtime.Object) string

func DeployerPodNameForDeployment

func DeployerPodNameForDeployment(deployment string) string

DeployerPodNameForDeployment returns the name of a pod for a given deployment

func DeployerPodSelector

func DeployerPodSelector(name string) labels.Selector

DeployerPodSelector returns a label Selector which can be used to find all deployer pods associated with a deployment with name.

func DeploymentConfigNameFor

func DeploymentConfigNameFor(obj runtime.Object) string

func DeploymentDesiredReplicas

func DeploymentDesiredReplicas(obj runtime.Object) (int32, bool)

func DeploymentNameFor

func DeploymentNameFor(obj runtime.Object) string

func DeploymentNameForConfigVersion

func DeploymentNameForConfigVersion(name string, version int64) string

DeploymentNameForConfigVersion returns the name of the version-th deployment for the config that has the provided name

func DeploymentReplicas

func DeploymentReplicas(obj runtime.Object) (int32, bool)

func DeploymentStatusFor

func DeploymentStatusFor(obj runtime.Object) deployapi.DeploymentStatus

func DeploymentStatusReasonFor

func DeploymentStatusReasonFor(obj runtime.Object) string

func DeploymentVersionFor

func DeploymentVersionFor(obj runtime.Object) int64

func DeploymentsForCleanup

func DeploymentsForCleanup(configuration *deployapi.DeploymentConfig, deployments []api.ReplicationController) []api.ReplicationController

DeploymentsForCleanup determines which deployments for a configuration are relevant for the revision history limit quota

func EncodeDeploymentConfig

func EncodeDeploymentConfig(config *deployapi.DeploymentConfig, codec runtime.Codec) (string, error)

EncodeDeploymentConfig encodes config as a string using codec.

func EncodedDeploymentConfigFor

func EncodedDeploymentConfigFor(obj runtime.Object) string

func GetAvailablePods

func GetAvailablePods(pods []*api.Pod, minReadySeconds int32) int32

GetAvailablePods returns all the available pods from the provided pod list.

func GetDeploymentCondition

GetDeploymentCondition returns the condition with the provided type.

func GetReplicaCountForDeployments

func GetReplicaCountForDeployments(deployments []api.ReplicationController) int32

GetReplicaCountForDeployments returns the sum of all replicas for the given deployments.

func GetStatusReplicaCountForDeployments

func GetStatusReplicaCountForDeployments(deployments []api.ReplicationController) int32

GetStatusReplicaCountForDeployments returns the sum of the replicas reported in the status of the given deployments.

func HasChangeTrigger

func HasChangeTrigger(config *deployapi.DeploymentConfig) bool

HasChangeTrigger returns whether the provided deployment configuration has a config change trigger or not

func HasImageChangeTrigger

func HasImageChangeTrigger(config *deployapi.DeploymentConfig) bool

HasImageChangeTrigger returns whether the provided deployment configuration has an image change trigger or not.

func HasSynced

func HasSynced(dc *deployapi.DeploymentConfig, generation int64) bool

HasSynced checks if the provided deployment config has been noticed by the deployment config controller.

func IsCompleteDeployment

func IsCompleteDeployment(deployment *api.ReplicationController) bool

IsCompleteDeployment returns true if the passed deployment failed.

func IsDeploymentCancelled

func IsDeploymentCancelled(deployment *api.ReplicationController) bool

func IsFailedDeployment

func IsFailedDeployment(deployment *api.ReplicationController) bool

IsFailedDeployment returns true if the passed deployment failed.

func IsOwnedByConfig

func IsOwnedByConfig(deployment *api.ReplicationController) bool

IsOwnedByConfig checks whether the provided replication controller is part of a deployment configuration. TODO: Switch to use owner references once we got those working.

func IsProgressing

func IsProgressing(config deployapi.DeploymentConfig, newStatus deployapi.DeploymentConfigStatus) bool

IsProgressing expects a state deployment config and its updated status in order to determine if there is any progress.

func IsRollingConfig

func IsRollingConfig(config *deployapi.DeploymentConfig) bool

IsRollingConfig returns true if the strategy type is a rolling update.

func IsTerminatedDeployment

func IsTerminatedDeployment(deployment *api.ReplicationController) bool

IsTerminatedDeployment returns true if the passed deployment has terminated (either complete or failed).

func LabelForDeployment

func LabelForDeployment(deployment *api.ReplicationController) string

LabelForDeployment builds a string identifier for a Deployment.

func LabelForDeploymentConfig

func LabelForDeploymentConfig(config *deployapi.DeploymentConfig) string

LabelForDeploymentConfig builds a string identifier for a DeploymentConfig.

func LatestDeploymentInfo

func LatestDeploymentInfo(config *deployapi.DeploymentConfig, deployments []api.ReplicationController) (bool, *api.ReplicationController)

LatestDeploymentInfo returns info about the latest deployment for a config, or nil if there is no latest deployment. The latest deployment is not always the same as the active deployment.

func LatestDeploymentNameForConfig

func LatestDeploymentNameForConfig(config *deployapi.DeploymentConfig) string

LatestDeploymentNameForConfig returns a stable identifier for config based on its version.

func MakeDeployment

func MakeDeployment(config *deployapi.DeploymentConfig, codec runtime.Codec) (*api.ReplicationController, error)

MakeDeployment creates a deployment represented as a ReplicationController and based on the given DeploymentConfig. The controller replica count will be zero.

func MaxSurge

func MaxSurge(config deployapi.DeploymentConfig) int32

MaxSurge returns the maximum surge pods a rolling deployment config can take.

func MaxUnavailable

func MaxUnavailable(config deployapi.DeploymentConfig) int32

MaxUnavailable returns the maximum unavailable pods a rolling deployment config can take.

func NewDeploymentCondition

func NewDeploymentCondition(condType deployapi.DeploymentConditionType, status api.ConditionStatus, reason, message string) *deployapi.DeploymentCondition

NewDeploymentCondition creates a new deployment condition.

func RemoveDeploymentCondition

func RemoveDeploymentCondition(status *deployapi.DeploymentConfigStatus, condType deployapi.DeploymentConditionType)

RemoveDeploymentCondition removes the deployment condition with the provided type.

func SetDeploymentCondition

func SetDeploymentCondition(status *deployapi.DeploymentConfigStatus, condition deployapi.DeploymentCondition)

SetDeploymentCondition updates the deployment to include the provided condition. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

func WaitForRunningDeployerPod

func WaitForRunningDeployerPod(podClient kclient.PodsNamespacer, rc *api.ReplicationController, timeout time.Duration) error

WaitForRunningDeployerPod waits a given period of time until the deployer pod for given replication controller is not running.

Types

type ByLatestVersionAsc

type ByLatestVersionAsc []api.ReplicationController

ByLatestVersionAsc sorts deployments by LatestVersion ascending.

func (ByLatestVersionAsc) Len

func (d ByLatestVersionAsc) Len() int

func (ByLatestVersionAsc) Less

func (d ByLatestVersionAsc) Less(i, j int) bool

func (ByLatestVersionAsc) Swap

func (d ByLatestVersionAsc) Swap(i, j int)

type ByLatestVersionDesc

type ByLatestVersionDesc []api.ReplicationController

ByLatestVersionDesc sorts deployments by LatestVersion descending.

func (ByLatestVersionDesc) Len

func (d ByLatestVersionDesc) Len() int

func (ByLatestVersionDesc) Less

func (d ByLatestVersionDesc) Less(i, j int) bool

func (ByLatestVersionDesc) Swap

func (d ByLatestVersionDesc) Swap(i, j int)

type ByMostRecent

type ByMostRecent []*api.ReplicationController

ByMostRecent sorts deployments by most recently created.

func (ByMostRecent) Len

func (s ByMostRecent) Len() int

func (ByMostRecent) Less

func (s ByMostRecent) Less(i, j int) bool

func (ByMostRecent) Swap

func (s ByMostRecent) Swap(i, j int)

Jump to

Keyboard shortcuts

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