util

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RevisionAnnotation is the revision annotation of a deployment's replica sets which records its rollout sequence
	RevisionAnnotation = "deployment.kubernetes.io/revision"
	// RevisionHistoryAnnotation maintains the history of all old revisions that a replica set has served for a deployment.
	RevisionHistoryAnnotation = "deployment.kubernetes.io/revision-history"
	// DesiredReplicasAnnotation is the desired replicas for a deployment recorded as an annotation
	// in its replica sets. Helps in separating scaling events from the rollout process and for
	// determining if the new replica set for a deployment is really saturated.
	DesiredReplicasAnnotation = "deployment.kubernetes.io/desired-replicas"
	// MaxReplicasAnnotation is the maximum replicas a deployment can have at a given point, which
	// is deployment.spec.replicas + maxSurge. Used by the underlying replica sets to estimate their
	// proportions in case the deployment has surge replicas.
	MaxReplicasAnnotation = "deployment.kubernetes.io/max-replicas"

	// RollbackRevisionNotFound is not found rollback event reason
	RollbackRevisionNotFound = "DeploymentRollbackRevisionNotFound"
	// RollbackTemplateUnchanged is the template unchanged rollback event reason
	RollbackTemplateUnchanged = "DeploymentRollbackTemplateUnchanged"
	// RollbackDone is the done rollback event reason
	RollbackDone = "DeploymentRollback"

	// ReplicaSetUpdatedReason is added in a deployment when one of its replica sets is updated as part
	// of the rollout process.
	ReplicaSetUpdatedReason = "ReplicaSetUpdated"
	// FailedRSCreateReason is added in a deployment when it cannot create a new replica set.
	FailedRSCreateReason = "ReplicaSetCreateError"
	// NewReplicaSetReason is added in a deployment when it creates a new replica set.
	NewReplicaSetReason = "NewReplicaSetCreated"
	// FoundNewRSReason is added in a deployment when it adopts an existing replica set.
	FoundNewRSReason = "FoundNewReplicaSet"
	// NewRSAvailableReason is added in a deployment when its newest replica set 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.
	NewRSAvailableReason = "NewReplicaSetAvailable"
	// TimedOutReason is added in a deployment when its newest replica set fails to show any progress
	// within the given deadline (progressDeadlineSeconds).
	TimedOutReason = "ProgressDeadlineExceeded"
	// PausedDeployReason is added in a deployment when it is paused. Lack of progress shouldn't be
	// estimated once a deployment is paused.
	PausedDeployReason = "DeploymentPaused"
	// ResumedDeployReason is added in a deployment when it is resumed. Useful for not failing accidentally
	// deployments that paused amidst a rollout and are bounded by a deadline.
	ResumedDeployReason = "DeploymentResumed"

	// MinimumReplicasAvailable is added in a deployment when it has its minimum replicas required available.
	MinimumReplicasAvailable = "MinimumReplicasAvailable"
	// MinimumReplicasUnavailable is added in a deployment when it doesn't have the minimum required replicas
	// available.
	MinimumReplicasUnavailable = "MinimumReplicasUnavailable"
)

Variables

This section is empty.

Functions

func DeploymentComplete

func DeploymentComplete(deployment *ketiv1.Deployment, newStatus *ketiv1.DeploymentStatus) bool

func DeploymentProgressing

func DeploymentProgressing(deployment *ketiv1.Deployment, newStatus *ketiv1.DeploymentStatus) bool

func DeploymentTimedOut

func DeploymentTimedOut(deployment *ketiv1.Deployment, newStatus *ketiv1.DeploymentStatus) bool

DeploymentTimedOut considers a deployment to have timed out once its condition that reports progress is older than progressDeadlineSeconds or a Progressing condition with a TimedOutReason reason already exists.

func EqualIgnoreHash

func EqualIgnoreHash(template1, template2 *ketiv1.PodTemplateSpec) bool

func FindActiveOrLatest

func FindActiveOrLatest(newRS *ketiv1.ReplicaSet, oldRSs []*ketiv1.ReplicaSet) *ketiv1.ReplicaSet

func FindNewReplicaSet

func FindNewReplicaSet(deployment *ketiv1.Deployment, rsList []*ketiv1.ReplicaSet) *ketiv1.ReplicaSet

func FindOldReplicaSets

func FindOldReplicaSets(deployment *ketiv1.Deployment, rsList []*ketiv1.ReplicaSet) ([]*ketiv1.ReplicaSet, []*ketiv1.ReplicaSet)

func GetActualReplicaCountForReplicaSets

func GetActualReplicaCountForReplicaSets(replicaSets []*ketiv1.ReplicaSet) int32

func GetAvailableReplicaCountForReplicaSets

func GetAvailableReplicaCountForReplicaSets(replicaSets []*ketiv1.ReplicaSet) int32

func GetDesiredReplicasAnnotation

func GetDesiredReplicasAnnotation(rs *ketiv1.ReplicaSet) (int32, bool)

func GetProportion

func GetProportion(rs *ketiv1.ReplicaSet, d ketiv1.Deployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32

func GetReadyReplicaCountForReplicaSets

func GetReadyReplicaCountForReplicaSets(replicaSets []*ketiv1.ReplicaSet) int32

func GetReplicaCountForReplicaSets

func GetReplicaCountForReplicaSets(replicaSets []*ketiv1.ReplicaSet) int32

func HasProgressDeadline

func HasProgressDeadline(d *ketiv1.Deployment) bool

func HasRevisionHistoryLimit

func HasRevisionHistoryLimit(d *ketiv1.Deployment) bool

func IsRollingUpdate

func IsRollingUpdate(deployment *ketiv1.Deployment) bool

func IsSaturated

func IsSaturated(deployment *ketiv1.Deployment, rs *ketiv1.ReplicaSet) bool

func LastRevision

func LastRevision(allRSs []*ketiv1.ReplicaSet) int64

func MaxRevision

func MaxRevision(allRSs []*ketiv1.ReplicaSet) int64

func MaxSurge

func MaxSurge(deployment ketiv1.Deployment) int32

func MaxUnavailable

func MaxUnavailable(deployment ketiv1.Deployment) int32

func NewDeploymentCondition

func NewDeploymentCondition(condType ketiv1.DeploymentConditionType, status v1.ConditionStatus, reason, message string) *ketiv1.DeploymentCondition

func NewRSNewReplicas

func NewRSNewReplicas(deployment *ketiv1.Deployment, allRSs []*ketiv1.ReplicaSet, newRS *ketiv1.ReplicaSet) (int32, error)

func RemoveDeploymentCondition

func RemoveDeploymentCondition(status *ketiv1.DeploymentStatus, condType ketiv1.DeploymentConditionType)

func ReplicasAnnotationsNeedUpdate

func ReplicasAnnotationsNeedUpdate(rs *ketiv1.ReplicaSet, desiredReplicas, maxReplicas int32) bool

func ResolveFenceposts

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

func Revision

func Revision(obj runtime.Object) (int64, error)

func SetDeploymentAnnotationsTo

func SetDeploymentAnnotationsTo(deployment *ketiv1.Deployment, rollbackToRS *ketiv1.ReplicaSet)

func SetDeploymentCondition

func SetDeploymentCondition(status *ketiv1.DeploymentStatus, condition ketiv1.DeploymentCondition)

func SetDeploymentRevision

func SetDeploymentRevision(deployment *ketiv1.Deployment, revision string) bool

func SetFromReplicaSetTemplate

func SetFromReplicaSetTemplate(deployment *ketiv1.Deployment, template ketiv1.PodTemplateSpec) *ketiv1.Deployment

func SetNewReplicaSetAnnotations

func SetNewReplicaSetAnnotations(deployment *ketiv1.Deployment, newRS *ketiv1.ReplicaSet, newRevision string, exists bool, revHistoryLimitInChars int) bool

func SetReplicasAnnotations

func SetReplicasAnnotations(rs *ketiv1.ReplicaSet, desiredReplicas, maxReplicas int32) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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