workloads

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Apache-2.0 Imports: 12 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) *v1alpha1.RolloutStatus

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

func (*CloneSetController) Finalize

Finalize makes sure the Cloneset is all upgraded

func (*CloneSetController) FinalizeOneBatch

func (c *CloneSetController) FinalizeOneBatch(ctx context.Context) *v1alpha1.RolloutStatus

FinalizeOneBatch makes sure that the rollout status are updated correctly

func (*CloneSetController) Initialize

Initialize makes sure that

func (*CloneSetController) RolloutOneBatchPods

func (c *CloneSetController) RolloutOneBatchPods(ctx context.Context) *v1alpha1.RolloutStatus

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

func (*CloneSetController) Size

func (c *CloneSetController) Size(ctx context.Context) (int32, error)

Size fetches the Cloneset and returns the replicas (not the actual number of pods)

func (*CloneSetController) Verify

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

type WorkloadController

type WorkloadController interface {
	// Size returns the total number of pods in the resources according to the spec
	Size(ctx context.Context) (int32, error)

	// Verify makes sure that the resources can be upgraded according to the rollout plan
	// it returns new rollout status
	Verify(ctx context.Context) *v1alpha1.RolloutStatus

	// Initialize make sure that the resource is ready to be upgraded.
	Initialize(ctx context.Context) *v1alpha1.RolloutStatus

	// RolloutOneBatchPods tries to upgrade pods in the resources following the rollout plan
	// it will upgrade as many pods as the rollout plan allows at once, the routine does not block on any operations.
	// Instead, we rely on the go-client's requeue mechanism to drive this towards the spec goal
	// it returns the number of pods upgraded in this round
	RolloutOneBatchPods(ctx context.Context) *v1alpha1.RolloutStatus

	// CheckOneBatchPods tries to upgrade pods in the resources following the rollout plan
	// it will upgrade as many pods as the rollout plan allows at once, the routine does not block on any operations.
	// Instead, we rely on the go-client's requeue mechanism to drive this towards the spec goal
	// it returns the number of pods upgraded in this round
	CheckOneBatchPods(ctx context.Context) *v1alpha1.RolloutStatus

	// FinalizeOneBatch makes sure that the rollout can start the next batch
	// it also needs to handle the corner cases around the very last batch
	FinalizeOneBatch(ctx context.Context) *v1alpha1.RolloutStatus

	// Finalize makes sure the resources are in a good final state.
	// For example, we may remove the source object to prevent scalar traits to ever work
	// and we will call the finalize rollout web hooks
	Finalize(ctx context.Context) *v1alpha1.RolloutStatus
}

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