util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeploymentStatusAnnotation is an annotation name used to retrieve the DeploymentPhase of
	// a deployment.
	// TODO: This is used by CLI, should be moved to library-go
	DeploymentStatusAnnotation = "openshift.io/deployment.phase"

	DeploymentVersionAnnotation = "openshift.io/deployment-config.latest-version"
	// DeploymentConfigAnnotation is an annotation name used to correlate a deployment with the
	DeploymentConfigAnnotation = "openshift.io/deployment-config.name"

	// DesiredReplicasAnnotation represents the desired number of replicas for a
	DesiredReplicasAnnotation = "kubectl.kubernetes.io/desired-replicas"
	// DeployerPodForDeploymentLabel is a label which groups pods related to a
	DeployerPodForDeploymentLabel = "openshift.io/deployer-pod-for.name"

	// DeploymentPodAnnotation is an annotation on a deployment (a ReplicationController). The
	DeploymentPodAnnotation = "openshift.io/deployer-pod.name"
)

Variables

This section is empty.

Functions

func ActiveDeployment

func ActiveDeployment(input []*v1.ReplicationController) *v1.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 AnnotationFor

func AnnotationFor(obj runtime.Object, key string) string

AnnotationFor returns the annotation with key for obj.

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 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)

DeploymentDesiredReplicas returns number of desired replica for the given replication controller

func DeploymentVersionFor

func DeploymentVersionFor(obj runtime.Object) int64

func HasSynced

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

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

func IsCompleteDeployment

func IsCompleteDeployment(deployment runtime.Object) bool

IsCompleteDeployment returns true if the passed deployment is in state complete.

func IsRollingConfig

func IsRollingConfig(config *appsv1.DeploymentConfig) bool

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

func LabelForDeployment

func LabelForDeployment(deployment *v1.ReplicationController) string

LabelForDeployment builds a string identifier for a Deployment.

func LatestDeploymentNameForConfigV1

func LatestDeploymentNameForConfigV1(config *appsv1.DeploymentConfig) string

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

func MaxSurge

func MaxSurge(config appsv1.DeploymentConfig) int32

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

func MaxUnavailable

func MaxUnavailable(config *appsv1.DeploymentConfig) int32

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

func NewReplicationControllerScaleClient

func NewReplicationControllerScaleClient(client kubernetes.Interface) scaleclient.ScalesGetter

func NewReplicationControllerScaler

func NewReplicationControllerScaler(client kubernetes.Interface) kubectl.Scaler

func ResolveFenceposts

func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)

ResolveFenceposts is copy from k8s deployment_utils to avoid unnecessary imports

Types

type ByLatestVersionAsc

type ByLatestVersionAsc []*v1.ReplicationController

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 []*v1.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 DeploymentStatus

type DeploymentStatus string

DeploymentStatus describes the possible states a deployment can be in.

Jump to

Keyboard shortcuts

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