rollingset

package
v0.0.0-...-432d548 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 44 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"

	// ReplicaUpdatedReason is added in a deployment when one of its replica sets is updated as part
	// of the rollout process.
	ReplicaUpdatedReason = "ReplicaUpdated"
	// FailedReplicaCreateReason is added in a deployment when it cannot create a new replica set.
	FailedReplicaCreateReason = "ReplicaCreateError"
	// NewReplicaReason is added in a deployment when it creates a new replica set.
	NewReplicaReason = "NewReplicaCreated"
	// FoundNewReplicaReason is added in a deployment when it adopts an existing replica set.
	FoundNewReplicaReason = "FoundNewReplica"
	// NewReplicaAvailableReason 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.
	NewReplicaAvailableReason = "NewReplicaAvailable"
	// 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 = "RollingsetPaused"
	// 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 = "RollingsetResumed"

	// 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"

	//ReplicaMaxBatchSize rolling处理replica一次批量上限
	ReplicaMaxBatchSize = 4000
	//TimeFormat TimeFormat
	TimeFormat = "2006-01-02-15-04-05"
)
View Source
const (

	// SuccessSynced is used as part of the Event 'reason' when a Rollingset is synced
	SuccessSynced = "Synced"
)

Variables

This section is empty.

Functions

func CalculateStatus

func CalculateStatus(rollingset *carbonv1.RollingSet, replicaSet []*carbonv1.Replica) (carbonv1.RollingSetStatus, int64)

CalculateStatus calculates the latest status for the provided deployment by looking into the provided replica sets.

func CheckSum

func CheckSum(rollingset *carbonv1.RollingSet) (string, error)

CheckSum rollingset checksum

func GetActiveReplicaCount

func GetActiveReplicaCount(replicaSet []*carbonv1.Replica) (activeReplicas, notAssignedReplicas, workerModeNotMatchReplicas int32)

GetActiveReplicaCount returns the number of active pods corresponding to the given replica sets.

func GetAllocatedReplicaCount

func GetAllocatedReplicaCount(replicaSet []*carbonv1.Replica) int32

GetAllocatedReplicaCount returns the number of allocated pods corresponding to the given replica sets.

func GetAvailableReplicaCount

func GetAvailableReplicaCount(replicaSet []*carbonv1.Replica) int32

GetAvailableReplicaCount returns the number of available pods corresponding to the given replica sets.

func GetCompleteReplicaCount

func GetCompleteReplicaCount(replicaSet []*carbonv1.Replica) int32

GetCompleteReplicaCount 已完成的replica数

func GetReleasingReplicaCount

func GetReleasingReplicaCount(replicaSet []*carbonv1.Replica) (int32, int32)

GetReleasingReplicaCount 获取rs释放中的replica数

func GetTotalWorkers

func GetTotalWorkers(replicaSet []*carbonv1.Replica) int32

GetTotalWorkers GetTotalWorkers

func GetUpdatedReplicaCount

func GetUpdatedReplicaCount(replicaSet []*carbonv1.Replica, latestVersion string) int32

GetUpdatedReplicaCount 已更新的replica数

func GetVersionCount

func GetVersionCount(replicaSet []*carbonv1.Replica, latestVersion string) int32

GetVersionCount 获取rollingset的版本数

func GroupByStandbyCount

func GroupByStandbyCount(replicaSet []*carbonv1.Replica) (cold, warm, hot int32)

GroupByStandbyCount return cold warm hot standby count

func HasSmoothFinalizer

func HasSmoothFinalizer(rollingset *carbonv1.RollingSet) bool

HasSmoothFinalizer 是否带了SmoothFinalizer

func RecordRollingsetHistory

func RecordRollingsetHistory(rollingset *carbonv1.RollingSet)

RecordRollingsetHistory 记录rollingset版本变更信息

func Signature

func Signature(a interface{}) (string, error)

Signature 计算签名

Types

type ByAvailableAndName

type ByAvailableAndName []*carbonv1.Replica

ByAvailableAndName 按照可用度排序, UnAvaiable,UnAssignedSolt排前面

func (ByAvailableAndName) Len

func (a ByAvailableAndName) Len() int

func (ByAvailableAndName) Less

func (a ByAvailableAndName) Less(i, j int) bool

func (ByAvailableAndName) Swap

func (a ByAvailableAndName) Swap(i, j int)

type ByDeletionCost

type ByDeletionCost []*carbonv1.Replica

func (ByDeletionCost) Len

func (a ByDeletionCost) Len() int

func (ByDeletionCost) Less

func (a ByDeletionCost) Less(i, j int) bool

func (ByDeletionCost) Swap

func (a ByDeletionCost) Swap(i, j int)

type ByScore

type ByScore []*carbonv1.Replica

ByScore 按照score升序排序, 根据score从小到大

func (ByScore) Len

func (a ByScore) Len() int

func (ByScore) Less

func (a ByScore) Less(i, j int) bool

func (ByScore) Swap

func (a ByScore) Swap(i, j int)

type ByUnAssignedSlot

type ByUnAssignedSlot []*carbonv1.Replica

ByUnAssignedSlot 按照AssignedSlot排序, AssignedSolt排前面

func (ByUnAssignedSlot) Len

func (a ByUnAssignedSlot) Len() int

func (ByUnAssignedSlot) Less

func (a ByUnAssignedSlot) Less(i, j int) bool

func (ByUnAssignedSlot) Swap

func (a ByUnAssignedSlot) Swap(i, j int)

type CmpFunc

type CmpFunc func(prev, obj interface{}) (bool, error)

CmpFunc ...

type Controller

type Controller struct {
	controller.DefaultController
	// contains filtered or unexported fields
}

Controller is the controller implementation for RollingSet resources

func NewController

func NewController(cluster string, kubeclientset kubernetes.Interface, carbonclientset clientset.Interface, rollingSetInformer informers.RollingSetInformer, workerInformer informers.WorkerNodeInformer, writeLabels map[string]string) *Controller

NewController returns a new rollingset controller

func (*Controller) DeleteSubObj

func (c *Controller) DeleteSubObj(namespace, name string) error

DeleteSubObj do garbage collect

func (*Controller) GetObj

func (c *Controller) GetObj(namespace, key string) (interface{}, error)

GetObj grep rollingSet

func (*Controller) Sync

func (c *Controller) Sync(key string) error

Sync compares the actual state with the desired, and attempts to converge the two.

func (*Controller) WaitForCacheSync

func (c *Controller) WaitForCacheSync(stopCh <-chan struct{}) bool

WaitForCacheSync wait informers synced

type InPlaceScheduler

type InPlaceScheduler struct {
	// contains filtered or unexported fields
}

InPlaceScheduler schedule the replicas in place

type InactiveStandbyRedundantSort

type InactiveStandbyRedundantSort []*carbonv1.Replica

InactiveStandbyRedundantSort Assigned/OnActive排前面

func (InactiveStandbyRedundantSort) Len

func (InactiveStandbyRedundantSort) Less

func (a InactiveStandbyRedundantSort) Less(i, j int) bool

func (InactiveStandbyRedundantSort) Swap

func (a InactiveStandbyRedundantSort) Swap(i, j int)

type Int64Slice

type Int64Slice []int64

func (Int64Slice) Len

func (x Int64Slice) Len() int

func (Int64Slice) Less

func (x Int64Slice) Less(i, j int) bool

func (Int64Slice) Swap

func (x Int64Slice) Swap(i, j int)

type RedundantSort

type RedundantSort []*carbonv1.Replica

RedundantSort Assigned/OnActive排前面

func (RedundantSort) Len

func (a RedundantSort) Len() int

func (RedundantSort) Less

func (a RedundantSort) Less(i, j int) bool

func (RedundantSort) Swap

func (a RedundantSort) Swap(i, j int)

Jump to

Keyboard shortcuts

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