replicas

package
v0.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AchievedDesiredReplicaPercentage

func AchievedDesiredReplicaPercentage(totalReplicaCount, currentReplicaCount uint, desiredPercentage float64) bool

AchievedDesiredCapacity verifies whether the given currentReplicaCount and totalReplicaCount match the given desiredCapacityPercentage.

Please note desiredPercentage might be a value between 0 and 100. In the case the informed desiredPercentage value is greater than 100, this function will panic; it is the caller's responsibility to check if the value falls in the 0-100 range.

func CalculateDesiredReplicaCount

func CalculateDesiredReplicaCount(totalReplicaCount uint, desiredCapacityPercentage float64) uint

CalculateDesiredNumberOfReplicas extracts the optimal replica count for the given totalReplicaCount and desiredCapacityPercentage values.

The returned value is a ceil'ed replica count calculated as a percentage of the given totalReplicaCount value. One of the considerations here is that the returned value will always return a replica count that is greater than the actual desired, and that is by design: we rather over than under capacity a deployment during a release process.

Considering the following strategy: 0%, 25%, 50%, 75% and 100% of 3 total replicas; this method will yield, the respective number of desired replicas: 0, 1, 2, 3 and 3. Those values are based on where the desired percentage falls on the divisible slices of 3 replicas: 0%, 1%-33%, 34%-66% and 67%-100%.

Types

This section is empty.

Jump to

Keyboard shortcuts

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