Documentation ¶
Index ¶
- Variables
- func CreateBaseStagePodAutoscaler(ro *v1.RolloutOrchestrator, revision *v1.TargetRevision) (spa *v1.StagePodAutoscaler)
- func IsStageScaleDownReady(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision) bool
- func IsStageScaleUpReady(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision) bool
- func NewRolloutStrategy(client clientset.Interface, kubeclient kubernetes.Interface, ...) map[string]*Rollout
- func UpdateSPAForRevDown(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision, scaleUpReady bool) *v1.StagePodAutoscaler
- func UpdateSPAForRevUp(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision, _ bool) *v1.StagePodAutoscaler
- type BaseScaleStep
- type Rollout
- type RolloutStep
- type ScaleDownStep
- type ScaleUpStep
Constants ¶
This section is empty.
Variables ¶
var ( // AvailabilityStrategy one strategy to roll out the new revision of the knative service, making sure the service is // always available. AvailabilityStrategy = "availability" // ResourceUtilStrategy is one strategy to roll out the new revision of the knative service, making sure the resource // is used optimized. It is possible that the service can have the downtime. ResourceUtilStrategy = "resourceutil" )
Functions ¶
func CreateBaseStagePodAutoscaler ¶
func CreateBaseStagePodAutoscaler(ro *v1.RolloutOrchestrator, revision *v1.TargetRevision) (spa *v1.StagePodAutoscaler)
CreateBaseStagePodAutoscaler returns the basic spa(StagePodAutoscaler), base on the RolloutOrchestrator and the revision.
func IsStageScaleDownReady ¶
func IsStageScaleDownReady(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision) bool
IsStageScaleDownReady decides whether the scaling down has completed for the current stage, based on the revision and the spa(StagePodAutoscaler).
func IsStageScaleUpReady ¶
func IsStageScaleUpReady(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision) bool
IsStageScaleUpReady decides whether the scaling up has completed or on the way for the current stage, based on the revision and the spa(StagePodAutoscaler).
func NewRolloutStrategy ¶
func NewRolloutStrategy(client clientset.Interface, kubeclient kubernetes.Interface, stagePodAutoscalerLister listers.StagePodAutoscalerLister) map[string]*Rollout
func UpdateSPAForRevDown ¶
func UpdateSPAForRevDown(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision, scaleUpReady bool) *v1.StagePodAutoscaler
UpdateSPAForRevDown update the SPA(StagePodAutoscaler) for the revision scaling down, based on the TargetReplicas min & max scales defined in the Knative Service, if the scaleUpReady is true.
If the scaleUpReady is false, no change to the SPA(StagePodAutoscaler).
func UpdateSPAForRevUp ¶
func UpdateSPAForRevUp(spa *v1.StagePodAutoscaler, revision *v1.TargetRevision, _ bool) *v1.StagePodAutoscaler
UpdateSPAForRevUp update the SPA(StagePodAutoscaler) for the revision scaling up, based on the TargetReplicas min & max scales defined in the Knative Service.
Types ¶
type BaseScaleStep ¶
type BaseScaleStep struct { Client clientset.Interface Kubeclient kubernetes.Interface StagePodAutoscalerLister listers.StagePodAutoscalerLister }
The BaseScaleStep struct defines golang clients, that are necessary to access the kubernetes resources. It also consists of the functions to create or update the SPAs for the revisions.
func (*BaseScaleStep) CreateOrUpdateSPARev ¶
func (r *BaseScaleStep) CreateOrUpdateSPARev(ctx context.Context, ro *v1.RolloutOrchestrator, targetRev *v1.TargetRevision, scaleUpReady bool, fn updateSPAForRev) (*v1.StagePodAutoscaler, error)
type Rollout ¶
type Rollout struct {
RolloutSteps []RolloutStep
}
The Rollout struct is responsible to roll out the new revision in multiple stages. It consists of an array of RolloutSteps, which will be called in sequence.
func (*Rollout) Reconcile ¶
func (r *Rollout) Reconcile(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, revScalingDown map[string]*v1.TargetRevision, enqueueAfter func(interface{}, time.Duration)) (bool, error)
Reconcile will iterate all RolloutSteps, calling Execute, Verify and ModifyStatus for each RolloutStep.
type RolloutStep ¶
type RolloutStep interface { // Execute function create or update the SPAs for the revisions to either scale up or down. Execute(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, revScalingDown map[string]*v1.TargetRevision) error // Verify function checks whether it reaches the completion of the scaling up or down for the revisions. Verify(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, revScalingDown map[string]*v1.TargetRevision, enqueueAfter func(interface{}, time.Duration)) (bool, error) // ModifyStatus function changes the status of the ro accordingly after the completion of the scaling up or down for the // revisions. ModifyStatus(ro *v1.RolloutOrchestrator) }
The RolloutStep interface defines all the functions, that are necessary to call to accomplish the rollout step. Currently, there are two type of steps, it could be either scaling up or scaling down.
type ScaleDownStep ¶
type ScaleDownStep struct {
BaseScaleStep
}
The ScaleDownStep struct is responsible for scaling down the pods for the old revisions.
func (*ScaleDownStep) Execute ¶
func (s *ScaleDownStep) Execute(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, revScalingDown map[string]*v1.TargetRevision) error
Execute for ScaleDownStep scales down the number of the pods for old revision by changing the minScale and maxScale for the SPA.
func (*ScaleDownStep) ModifyStatus ¶
func (s *ScaleDownStep) ModifyStatus(ro *v1.RolloutOrchestrator)
ModifyStatus for ScaleDownStep modifies the status of the rolloutOrchestrator after the old revision has scaled down to the expected number of pods.
func (*ScaleDownStep) Verify ¶
func (s *ScaleDownStep) Verify(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, revScalingDown map[string]*v1.TargetRevision, enqueueAfter func(interface{}, time.Duration)) (bool, error)
Verify for ScaleDownStep verified if the number of pods for the old revision has scaled down to the expected number.
type ScaleUpStep ¶
type ScaleUpStep struct {
BaseScaleStep
}
The ScaleUpStep struct is responsible for scaling up the pods for the new revision.
func (*ScaleUpStep) Execute ¶
func (s *ScaleUpStep) Execute(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, _ map[string]*v1.TargetRevision) error
Execute for ScaleUpStep scales up the number of the pods for new revision by changing the minScale and maxScale for the SPA.
func (*ScaleUpStep) ModifyStatus ¶
func (s *ScaleUpStep) ModifyStatus(ro *v1.RolloutOrchestrator)
ModifyStatus for ScaleUpStep modifies the status of the rolloutOrchestrator after the new revision has scaled up to the expected number of pods.
func (*ScaleUpStep) Verify ¶
func (s *ScaleUpStep) Verify(ctx context.Context, ro *v1.RolloutOrchestrator, revScalingUp, revScalingDown map[string]*v1.TargetRevision, _ func(interface{}, time.Duration)) (bool, error)
Verify for ScaleUpStep verified if the number of pods for the new revision has scaled up to the expected number.