workloads

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifySumOfBatchSizes

func VerifySumOfBatchSizes(rolloutSpec *v1alpha1.RolloutPlan, totalReplicas int32) error

VerifySumOfBatchSizes verifies that the the sum of all the batch replicas is valid given the total replica each batch replica can be absolute or a percentage

Types

type CloneSetController

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

CloneSetController is responsible for handle Cloneset type of workloads

func NewCloneSetController

func NewCloneSetController(client client.Client, recorder event.Recorder, parentController oam.Object,
	rolloutSpec *v1alpha1.RolloutPlan, rolloutStatus *v1alpha1.RolloutStatus, workloadName types.NamespacedName) *CloneSetController

NewCloneSetController creates a new Cloneset controller

func (*CloneSetController) CheckOneBatchPods

func (c *CloneSetController) CheckOneBatchPods(ctx context.Context) (bool, error)

CheckOneBatchPods checks to see if the pods are all available according to the rollout plan

func (*CloneSetController) Finalize

func (c *CloneSetController) Finalize(ctx context.Context, succeed bool) bool

Finalize makes sure the Cloneset is all upgraded

func (*CloneSetController) FinalizeOneBatch

func (c *CloneSetController) FinalizeOneBatch(ctx context.Context) (bool, error)

FinalizeOneBatch makes sure that the rollout status are updated correctly

func (*CloneSetController) Initialize

func (c *CloneSetController) Initialize(ctx context.Context) (bool, error)

Initialize makes sure that the cloneset is under our control

func (*CloneSetController) RolloutOneBatchPods

func (c *CloneSetController) RolloutOneBatchPods(ctx context.Context) (bool, error)

RolloutOneBatchPods calculates the number of pods we can upgrade once according to the rollout spec and then set the partition accordingly, return if we are done

func (*CloneSetController) VerifySpec added in v1.0.0

func (c *CloneSetController) VerifySpec(ctx context.Context) (bool, error)

VerifySpec verifies that the target rollout resource is consistent with the rollout spec

type DeploymentController added in v1.0.0

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

DeploymentController is responsible for handling rollout deployment type of workloads

func NewDeploymentController added in v1.0.0

func NewDeploymentController(client client.Client, recorder event.Recorder, parentController oam.Object,
	rolloutSpec *v1alpha1.RolloutPlan, rolloutStatus *v1alpha1.RolloutStatus, sourceNamespacedName,
	targetNamespacedName types.NamespacedName) *DeploymentController

NewDeploymentController creates a new deployment rollout controller

func (*DeploymentController) CheckOneBatchPods added in v1.0.0

func (c *DeploymentController) CheckOneBatchPods(ctx context.Context) (bool, error)

CheckOneBatchPods checks to see if the pods are all available according to the rollout plan

func (*DeploymentController) Finalize added in v1.0.0

func (c *DeploymentController) Finalize(ctx context.Context, succeed bool) bool

Finalize makes sure the Deployment is all upgraded

func (*DeploymentController) FinalizeOneBatch added in v1.0.0

func (c *DeploymentController) FinalizeOneBatch(ctx context.Context) (bool, error)

FinalizeOneBatch makes sure that the rollout status are updated correctly

func (*DeploymentController) Initialize added in v1.0.0

func (c *DeploymentController) Initialize(ctx context.Context) (bool, error)

Initialize makes sure that the source and target deployment is under our control

func (*DeploymentController) RolloutOneBatchPods added in v1.0.0

func (c *DeploymentController) RolloutOneBatchPods(ctx context.Context) (bool, error)

RolloutOneBatchPods calculates the number of pods we can upgrade once according to the rollout spec and then set the partition accordingly

func (*DeploymentController) VerifySpec added in v1.0.0

func (c *DeploymentController) VerifySpec(ctx context.Context) (bool, error)

VerifySpec verifies that the rollout resource is consistent with the rollout spec

type WorkloadController

type WorkloadController interface {
	// VerifySpec makes sure that the resources can be upgraded according to the rollout plan
	// it returns if the verification succeeded/failed or should retry
	VerifySpec(ctx context.Context) (bool, error)

	// Initialize make sure that the resource is ready to be upgraded
	// this function is tasked to do any initialization work on the resources
	// it returns if the initialization succeeded/failed or should retry
	Initialize(ctx context.Context) (bool, error)

	// RolloutOneBatchPods tries to upgrade pods in the resources following the rollout plan
	// it will upgrade pods as the rollout plan allows at once
	// it returns if the upgrade actionable items succeeded/failed or should continue
	RolloutOneBatchPods(ctx context.Context) (bool, error)

	// CheckOneBatchPods checks how many pods are ready to serve requests in the current batch
	// it returns whether the number of pods upgraded in this round satisfies the rollout plan
	CheckOneBatchPods(ctx context.Context) (bool, error)

	// FinalizeOneBatch makes sure that the rollout can start the next batch
	// it returns if the finalization of this batch succeeded/failed or should retry
	FinalizeOneBatch(ctx context.Context) (bool, error)

	// Finalize makes sure the resources are in a good final state.
	// It might depend on if the rollout succeeded or not.
	// For example, we may remove the source object to prevent scalar traits to ever work
	// and the finalize rollout web hooks will be called after this call succeeds
	Finalize(ctx context.Context, succeed bool) bool
}

WorkloadController is the interface that all type of cloneSet controller implements

Jump to

Keyboard shortcuts

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