Documentation
¶
Index ¶
- func CanaryThreshold(squad carrierv1alpha1.Squad) int32
- func ComputeHash(template *carrierv1alpha1.GameServerTemplateSpec) string
- func ComputePodSpecHash(spec *corev1.PodSpec) string
- func EqualGameServerTemplate(template1, template2 *carrierv1alpha1.GameServerTemplateSpec) bool
- func FilterActiveGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) []*carrierv1alpha1.GameServerSet
- func FilterGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet, filterFn filterGSSet) []*carrierv1alpha1.GameServerSet
- func FindActiveOrLatest(newGSSet *carrierv1alpha1.GameServerSet, ...) *carrierv1alpha1.GameServerSet
- func FindNewGameServerSet(squad *carrierv1alpha1.Squad, gsSetList []*carrierv1alpha1.GameServerSet) *carrierv1alpha1.GameServerSet
- func FindOldGameServerSets(squad *carrierv1alpha1.Squad, gsSetList []*carrierv1alpha1.GameServerSet) ([]*carrierv1alpha1.GameServerSet, []*carrierv1alpha1.GameServerSet)
- func GameServerSetToSquadCondition(cond carrierv1alpha1.GameServerSetCondition) carrierv1alpha1.SquadCondition
- func GetActualReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
- func GetDesiredReplicasAnnotation(gsSet *carrierv1alpha1.GameServerSet) (int32, bool)
- func GetProportion(gsSet *carrierv1alpha1.GameServerSet, squad carrierv1alpha1.Squad, ...) int32
- func GetReadyReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
- func GetReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
- func GetSquadCondition(status carrierv1alpha1.SquadStatus, ...) *carrierv1alpha1.SquadCondition
- func GetUpdateReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
- func HasRevisionHistoryLimit(squad *carrierv1alpha1.Squad) bool
- func InplaceThreshold(squad carrierv1alpha1.Squad) int32
- func IsCanaryUpdate(squad *carrierv1alpha1.Squad) bool
- func IsGameServerSetScaling(gsSet *carrierv1alpha1.GameServerSet, squad *carrierv1alpha1.Squad) bool
- func IsGracefulUpdate(squad *carrierv1alpha1.Squad) bool
- func IsInplaceUpdate(squad *carrierv1alpha1.Squad) bool
- func IsRollingUpdate(squad *carrierv1alpha1.Squad) bool
- func IsSaturated(squad *carrierv1alpha1.Squad, gsSet *carrierv1alpha1.GameServerSet) bool
- func LastRevision(allGSSets []*carrierv1alpha1.GameServerSet) int64
- func MaxRevision(allGSSets []*carrierv1alpha1.GameServerSet) int64
- func MaxSurge(squad carrierv1alpha1.Squad) int32
- func MaxUnavailable(squad carrierv1alpha1.Squad) int32
- func NewGSSetNewReplicas(squad *carrierv1alpha1.Squad, allGSSets []*carrierv1alpha1.GameServerSet, ...) (int32, error)
- func NewSquadCondition(condType carrierv1alpha1.SquadConditionType, status corev1.ConditionStatus, ...) *carrierv1alpha1.SquadCondition
- func RemoveSquadCondition(status *carrierv1alpha1.SquadStatus, ...)
- func ReplicasAnnotationsNeedUpdate(gsSet *carrierv1alpha1.GameServerSet, desiredReplicas, maxReplicas int32) bool
- func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)
- func Revision(obj runtime.Object) (int64, error)
- func SetFromGameServerSetTemplate(squad *carrierv1alpha1.Squad, template carrierv1alpha1.GameServerTemplateSpec) *carrierv1alpha1.Squad
- func SetGameServerSetInplaceUpdateAnnotations(gsSet *carrierv1alpha1.GameServerSet, squad *carrierv1alpha1.Squad)
- func SetGameServerTemplateHashLabels(gsSet *carrierv1alpha1.GameServerSet)
- func SetNewGameServerSetAnnotations(squad *carrierv1alpha1.Squad, newGSSet *carrierv1alpha1.GameServerSet, ...) bool
- func SetReplicasAnnotations(gsSet *carrierv1alpha1.GameServerSet, desiredReplicas, maxReplicas int32) bool
- func SetScalingAnnotations(gsSet *carrierv1alpha1.GameServerSet) bool
- func SetSquadAnnotationsTo(squad *carrierv1alpha1.Squad, rollbackToGSSet *carrierv1alpha1.GameServerSet)
- func SetSquadCondition(status *carrierv1alpha1.SquadStatus, condition carrierv1alpha1.SquadCondition)
- func SetSquadRevision(squad *carrierv1alpha1.Squad, revision string) bool
- func SquadComplete(squad *carrierv1alpha1.Squad, newStatus *carrierv1alpha1.SquadStatus) bool
- func SquadProgressing(squad *carrierv1alpha1.Squad, newStatus *carrierv1alpha1.SquadStatus) bool
- type Controller
- type GameServerSetsByCreationTimestamp
- type GameServerSetsBySizeNewer
- type GameServerSetsBySizeOlder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanaryThreshold ¶
func CanaryThreshold(squad carrierv1alpha1.Squad) int32
CanaryThreshold return the replicas of CanaryUpdate
func ComputeHash ¶
func ComputeHash(template *carrierv1alpha1.GameServerTemplateSpec) string
ComputeHash returns a hash value calculated from GameServerTemplateSpec
func ComputePodSpecHash ¶
ComputePodSpecHash return the hash value of the podspec
func EqualGameServerTemplate ¶
func EqualGameServerTemplate(template1, template2 *carrierv1alpha1.GameServerTemplateSpec) bool
EqualGameServerTemplate returns true if two given GameServerTemplateSpec are equal, ignoring some diff in value of Labels
func FilterActiveGameServerSets ¶
func FilterActiveGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) []*carrierv1alpha1.GameServerSet
FilterActiveGameServerSets returns GameServerSets that have (or at least ought to have) GameServers.
func FilterGameServerSets ¶
func FilterGameServerSets( gsSetList []*carrierv1alpha1.GameServerSet, filterFn filterGSSet) []*carrierv1alpha1.GameServerSet
FilterGameServerSets returns GameServerSet that are filtered by filterFn (all returned ones should match filterFn).
func FindActiveOrLatest ¶
func FindActiveOrLatest( newGSSet *carrierv1alpha1.GameServerSet, oldGSSets []*carrierv1alpha1.GameServerSet) *carrierv1alpha1.GameServerSet
FindActiveOrLatest returns the only active or the latest GameServerSet in case there is at most one active GameServerSet. If there are more active GameServerSet, then we should proportionally scale them.
func FindNewGameServerSet ¶
func FindNewGameServerSet( squad *carrierv1alpha1.Squad, gsSetList []*carrierv1alpha1.GameServerSet) *carrierv1alpha1.GameServerSet
FindNewGameServerSet returns the new GameServerSet this given Squad targets (the one with the same GameServer template).
func FindOldGameServerSets ¶
func FindOldGameServerSets( squad *carrierv1alpha1.Squad, gsSetList []*carrierv1alpha1.GameServerSet) ([]*carrierv1alpha1.GameServerSet, []*carrierv1alpha1.GameServerSet)
FindOldGameServerSets returns the old GameServerSets targeted by the given Squad, with the given slice of GameServerSets. Note that the first set of old GameServerSets doesn't include the ones with no GameServers, and the second set of old GameServerSets include all old GameServerSets.
func GameServerSetToSquadCondition ¶
func GameServerSetToSquadCondition(cond carrierv1alpha1.GameServerSetCondition) carrierv1alpha1.SquadCondition
GameServerSetToSquadCondition converts a GameServerSet condition into a Squad condition. Useful for promoting GameServerSet failure conditions into Squad.
func GetActualReplicaCountForGameServerSets ¶
func GetActualReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
GetActualReplicaCountForGameServerSets returns the sum of actual replicas of the given GameServerSet.
func GetDesiredReplicasAnnotation ¶
func GetDesiredReplicasAnnotation(gsSet *carrierv1alpha1.GameServerSet) (int32, bool)
GetDesiredReplicasAnnotation returns the number of desired replicas
func GetProportion ¶
func GetProportion( gsSet *carrierv1alpha1.GameServerSet, squad carrierv1alpha1.Squad, squadReplicasToAdd, squadReplicasAdded int32) int32
GetProportion will estimate the proportion for the provided GameServerSet using 1. the current size of the parent Squad 2. the replica count that needs be added on the GameServerSet of the Squad 3. the total replicas added in the GameServerSet of the Squad so far.
func GetReadyReplicaCountForGameServerSets ¶
func GetReadyReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
GetReadyReplicaCountForGameServerSets returns the number of ready GameServers corresponding to the given GameServerSets.
func GetReplicaCountForGameServerSets ¶
func GetReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
GetReplicaCountForGameServerSets returns the sum of Replicas of the given GameServerSets.
func GetSquadCondition ¶
func GetSquadCondition( status carrierv1alpha1.SquadStatus, condType carrierv1alpha1.SquadConditionType) *carrierv1alpha1.SquadCondition
GetSquadCondition returns the condition with the provided type.
func GetUpdateReplicaCountForGameServerSets ¶
func GetUpdateReplicaCountForGameServerSets(gsSetList []*carrierv1alpha1.GameServerSet) int32
GetUpdateReplicaCountForGameServerSets returns the sum of update replicas of the given GameServerSet.
func HasRevisionHistoryLimit ¶
func HasRevisionHistoryLimit(squad *carrierv1alpha1.Squad) bool
HasRevisionHistoryLimit checks if the Squad d is expected to keep a specified number of old GameServerSets
func InplaceThreshold ¶
func InplaceThreshold(squad carrierv1alpha1.Squad) int32
InplaceThreshold return the replicas of InplaceUpdate
func IsCanaryUpdate ¶
func IsCanaryUpdate(squad *carrierv1alpha1.Squad) bool
IsCanaryUpdate returns true if the strategy type is a canary update.
func IsGameServerSetScaling ¶
func IsGameServerSetScaling(gsSet *carrierv1alpha1.GameServerSet, squad *carrierv1alpha1.Squad) bool
IsGameServerSetScaling return true if only scaling GameServerSet
func IsGracefulUpdate ¶
func IsGracefulUpdate(squad *carrierv1alpha1.Squad) bool
IsGracefulUpdate return true if only 'GracefulUpdateAnnotation' is true
func IsInplaceUpdate ¶
func IsInplaceUpdate(squad *carrierv1alpha1.Squad) bool
IsInplaceUpdate returns true if the strategy type is a inplace update
func IsRollingUpdate ¶
func IsRollingUpdate(squad *carrierv1alpha1.Squad) bool
IsRollingUpdate returns true if the strategy type is a rolling update.
func IsSaturated ¶
func IsSaturated(squad *carrierv1alpha1.Squad, gsSet *carrierv1alpha1.GameServerSet) bool
IsSaturated checks if the new GameServerSet is saturated by comparing its size with its Squad size.
func LastRevision ¶
func LastRevision(allGSSets []*carrierv1alpha1.GameServerSet) int64
LastRevision finds the second max revision number in all GameServerSet (the last revision)
func MaxRevision ¶
func MaxRevision(allGSSets []*carrierv1alpha1.GameServerSet) int64
MaxRevision finds the highest revision in the GameServerSet
func MaxSurge ¶
func MaxSurge(squad carrierv1alpha1.Squad) int32
MaxSurge returns the maximum surge GameServers a rolling squad can take.
func MaxUnavailable ¶
func MaxUnavailable(squad carrierv1alpha1.Squad) int32
MaxUnavailable returns the maximum unavailable GameServers a rolling squad can take.
func NewGSSetNewReplicas ¶
func NewGSSetNewReplicas( squad *carrierv1alpha1.Squad, allGSSets []*carrierv1alpha1.GameServerSet, newGSSet *carrierv1alpha1.GameServerSet) (int32, error)
NewGSSetNewReplicas calculates the number of replicas a squad's new GSSet should have. When one of the followings is true, we're rolling out the squad; otherwise, we're scaling it. 1) The new GSSet is saturated: newGSSet's replicas == squad's replicas 2) Max number of GameServers allowed is reached: squad's replicas + maxSurge == all GSSets' replicas
func NewSquadCondition ¶
func NewSquadCondition( condType carrierv1alpha1.SquadConditionType, status corev1.ConditionStatus, reason, message string) *carrierv1alpha1.SquadCondition
NewSquadCondition creates a new squad condition.
func RemoveSquadCondition ¶
func RemoveSquadCondition(status *carrierv1alpha1.SquadStatus, condType carrierv1alpha1.SquadConditionType)
RemoveSquadCondition removes the Squad condition with the provided type.
func ReplicasAnnotationsNeedUpdate ¶
func ReplicasAnnotationsNeedUpdate(gsSet *carrierv1alpha1.GameServerSet, desiredReplicas, maxReplicas int32) bool
ReplicasAnnotationsNeedUpdate return true if ReplicasAnnotations need to be updated
func ResolveFenceposts ¶
func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)
ResolveFenceposts resolves both maxSurge and maxUnavailable. This needs to happen in one step. For example:
2 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1), then old(-1), then new(+1) 1 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1) 2 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1) 2 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1)
func SetFromGameServerSetTemplate ¶
func SetFromGameServerSetTemplate( squad *carrierv1alpha1.Squad, template carrierv1alpha1.GameServerTemplateSpec) *carrierv1alpha1.Squad
SetFromGameServerSetTemplate sets the desired GameServerTemplateSpec from a GameServerSettemplate to the given squad.
func SetGameServerSetInplaceUpdateAnnotations ¶
func SetGameServerSetInplaceUpdateAnnotations(gsSet *carrierv1alpha1.GameServerSet, squad *carrierv1alpha1.Squad)
SetGameServerSetInplaceUpdateAnnotations setting GameServerSet annotations when inplace update
func SetGameServerTemplateHashLabels ¶
func SetGameServerTemplateHashLabels(gsSet *carrierv1alpha1.GameServerSet)
SetGameServerTemplateHashLabels setting pod spec hash to GameServerSet labels
func SetNewGameServerSetAnnotations ¶
func SetNewGameServerSetAnnotations( squad *carrierv1alpha1.Squad, newGSSet *carrierv1alpha1.GameServerSet, newRevision string, exists bool, revHistoryLimitInChars int) bool
SetNewGameServerSetAnnotations sets new GameServerSet's annotations appropriately by updating its revision and copying required Squad annotations to it; it returns true if GameServerSet's annotation is changed.
func SetReplicasAnnotations ¶
func SetReplicasAnnotations(gsSet *carrierv1alpha1.GameServerSet, desiredReplicas, maxReplicas int32) bool
SetReplicasAnnotations sets the desiredReplicas and maxReplicas into the annotations
func SetScalingAnnotations ¶
func SetScalingAnnotations(gsSet *carrierv1alpha1.GameServerSet) bool
SetScalingAnnotations sets the scaling mark into the annotations
func SetSquadAnnotationsTo ¶
func SetSquadAnnotationsTo(squad *carrierv1alpha1.Squad, rollbackToGSSet *carrierv1alpha1.GameServerSet)
SetSquadAnnotationsTo sets Squad's annotations as given GSSet's annotations. This action should be done if and only if the Squad is rolling back to this rs. Note that apply and revision annotations are not changed.
func SetSquadCondition ¶
func SetSquadCondition(status *carrierv1alpha1.SquadStatus, condition carrierv1alpha1.SquadCondition)
SetSquadCondition updates the squad 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 SetSquadRevision ¶
func SetSquadRevision(squad *carrierv1alpha1.Squad, revision string) bool
SetSquadRevision updates the revision for a squad.
func SquadComplete ¶
func SquadComplete(squad *carrierv1alpha1.Squad, newStatus *carrierv1alpha1.SquadStatus) bool
SquadComplete considers a Squad to be complete once all of its desired replicas are updated , and no old GameServers are running.
func SquadProgressing ¶
func SquadProgressing(squad *carrierv1alpha1.Squad, newStatus *carrierv1alpha1.SquadStatus) bool
SquadProgressing reports progress for a Squad. Progress is estimated by comparing the current with the new status of the Squad that the controller is observing. More specifically, when new GameServers are scaled up or become ready or available, or old GameServers are scaled down, then we consider the Squad is progressing.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a the GameServerSet controller
func NewController ¶
func NewController( kubeClient kubernetes.Interface, carrierClient versioned.Interface, carrierInformerFactory externalversions.SharedInformerFactory) *Controller
NewController returns a new squads crd controller
func (*Controller) Run ¶
func (c *Controller) Run(workers int, stop <-chan struct{}) error
Run the Squad controller. Will block until stop is closed. Runs threadiness number workers to process the rate limited queue
type GameServerSetsByCreationTimestamp ¶
type GameServerSetsByCreationTimestamp []*carrierv1alpha1.GameServerSet
GameServerSetsByCreationTimestamp sorts a list of GameServerSet by creation timestamp, using their names as a tie breaker.
func (GameServerSetsByCreationTimestamp) Len ¶
func (o GameServerSetsByCreationTimestamp) Len() int
These three methods implement sort.Interface Len methods
func (GameServerSetsByCreationTimestamp) Less ¶
func (o GameServerSetsByCreationTimestamp) Less(i, j int) bool
Less methods
func (GameServerSetsByCreationTimestamp) Swap ¶
func (o GameServerSetsByCreationTimestamp) Swap(i, j int)
Swap methods
type GameServerSetsBySizeNewer ¶
type GameServerSetsBySizeNewer []*carrierv1alpha1.GameServerSet
GameServerSetsBySizeNewer sorts a list of GameServerSet by size in descending order, using their creation timestamp or name as a tie breaker. By using the creation timestamp, this sorts from new to old GameServerSet.
func (GameServerSetsBySizeNewer) Len ¶
func (o GameServerSetsBySizeNewer) Len() int
These three methods implement sort.Interface Len methods
func (GameServerSetsBySizeNewer) Less ¶
func (o GameServerSetsBySizeNewer) Less(i, j int) bool
Less methods
func (GameServerSetsBySizeNewer) Swap ¶
func (o GameServerSetsBySizeNewer) Swap(i, j int)
Swap methods
type GameServerSetsBySizeOlder ¶
type GameServerSetsBySizeOlder []*carrierv1alpha1.GameServerSet
GameServerSetsBySizeOlder sorts a list of GameServerSet by size in descending order, using their creation timestamp or name as a tie breaker. By using the creation timestamp, this sorts from old to new GameServerSet.
func (GameServerSetsBySizeOlder) Len ¶
func (o GameServerSetsBySizeOlder) Len() int
These three methods implement sort.Interface Len methods
func (GameServerSetsBySizeOlder) Less ¶
func (o GameServerSetsBySizeOlder) Less(i, j int) bool
Less methods
func (GameServerSetsBySizeOlder) Swap ¶
func (o GameServerSetsBySizeOlder) Swap(i, j int)
Swap methods