Documentation ¶
Index ¶
Constants ¶
const MaxScore = 100
MaxScore is the upper bound of the normalized score.
const MinScore = -100
MinScore is the lower bound of the normalized score.
Variables ¶
var RolloutClock = clock.Clock(clock.RealClock{})
Functions ¶
func NewScoreNormalizer ¶ added in v0.15.0
func NewScoreNormalizer(min, max float64) *scoreNormalizer
NewScoreNormalizer creates a new instance of scoreNormalizer with given min and max values.
Types ¶
type ClusterRolloutStatus ¶
type ClusterRolloutStatus struct { // cluster name ClusterName string // GroupKey represents the cluster group key (optional field). GroupKey clusterv1beta1sdk.GroupKey // Status is the required field indicating the rollout status. Status RolloutStatus // LastTransitionTime is the last transition time of the rollout status (optional field). // Used to calculate timeout for progressing and failed status and minimum success time (i.e. soak // time) for succeeded status. LastTransitionTime *metav1.Time // TimeOutTime is the timeout time when the status is progressing or failed (optional field). TimeOutTime *metav1.Time }
ClusterRolloutStatus holds the rollout status information for a cluster.
type ClusterRolloutStatusFunc ¶
type ClusterRolloutStatusFunc[T any] func(clusterName string, workload T) (ClusterRolloutStatus, error)
ClusterRolloutStatusFunc defines a function that return the rollout status for a given workload.
type RolloutHandler ¶
type RolloutHandler[T any] struct { // contains filtered or unexported fields }
The RolloutHandler required workload type (interface/struct) to be assigned to the generic type. The custom implementation of the ClusterRolloutStatusFunc is required to use the RolloutHandler.
func NewRolloutHandler ¶
func NewRolloutHandler[T any](pdTracker *clusterv1beta1sdk.PlacementDecisionClustersTracker, statusFunc ClusterRolloutStatusFunc[T]) (*RolloutHandler[T], error)
NewRolloutHandler creates a new RolloutHandler with the given workload type.
func (*RolloutHandler[T]) GetRolloutCluster ¶
func (r *RolloutHandler[T]) GetRolloutCluster(rolloutStrategy clusterv1alpha1.RolloutStrategy, existingClusterStatus []ClusterRolloutStatus) (*clusterv1alpha1.RolloutStrategy, RolloutResult, error)
The inputs are a RolloutStrategy and existingClusterRolloutStatus list. The existing ClusterRolloutStatus list should be created using the ClusterRolloutStatusFunc to determine the current workload rollout status. The existing ClusterRolloutStatus list should contain all the current workloads rollout status such as ToApply, Progressing, Succeeded, Failed, TimeOut and Skip in order to determine the added, removed, timeout clusters and next clusters to rollout.
Return the actual RolloutStrategy that take effect and a RolloutResult contain list of ClusterToRollout, ClustersTimeout and ClusterRemoved.
type RolloutResult ¶
type RolloutResult struct { // ClustersToRollout is a slice of ClusterRolloutStatus that will be rolled out. ClustersToRollout []ClusterRolloutStatus // ClustersTimeOut is a slice of ClusterRolloutStatus that are timeout. ClustersTimeOut []ClusterRolloutStatus // ClustersRemoved is a slice of ClusterRolloutStatus that are removed. ClustersRemoved []ClusterRolloutStatus // MaxFailureBreach is a boolean signaling whether the rollout was cut short because of failed clusters. MaxFailureBreach bool // RecheckAfter is the time duration to recheck the rollout status. RecheckAfter *time.Duration }
RolloutResult contains list of clusters that are timeOut, removed and required to rollOut. A boolean is also provided signaling that the rollout may be shortened due to the number of failed clusters exceeding the MaxFailure threshold.
type RolloutStatus ¶
type RolloutStatus int
RolloutStatus represents the status of a rollout operation.
const ( // ToApply indicates that the resource's desired status has not been applied yet. ToApply RolloutStatus = iota // Progressing indicates that the resource's desired status is applied and last applied status is not updated. Progressing // Succeeded indicates that the resource's desired status is applied and last applied status is successful. Succeeded // Failed indicates that the resource's desired status is applied and last applied status has failed. Failed // TimeOut indicates that the rollout status is progressing or failed and the status remains // for longer than the timeout, resulting in a timeout status. TimeOut // Skip indicates that the rollout should be skipped on this cluster. Skip )