workload

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePartitionReplicas

func CalculatePartitionReplicas(totalReplicas *int32, partition intstr.IntOrString) (int32, error)

func GetClusterFromLabel

func GetClusterFromLabel(labels map[string]string) string

func PatchMetadata added in v0.1.0

func PatchMetadata(meta *metav1.ObjectMeta, patch rolloutv1alpha1.MetadataPatch)

PatchMetadata patches metadata with the given patch

Types

type BatchStrategy added in v0.1.0

type BatchStrategy interface {
	// Initialize initializes the stable workload.
	// It claims the stable workload is in batch release process controlled by rolloutRun
	Initialize(rollout, rolloutRun string, batchIndex int32) error

	// UpgradePartition upgrades the workload to the specified partition
	// It should return true if the workload changed.
	//
	// NOTE: This function must be idempotent.
	UpgradePartition(partition intstr.IntOrString) (bool, error)
}

type CanaryInterface added in v0.1.0

type CanaryInterface interface {
	// CreateOrUpdate ensures the canary workload is created and updated.
	CreateOrUpdate(canaryReplicas intstr.IntOrString, podTemplatePatch *rolloutv1alpha1.MetadataPatch) (controllerutil.OperationResult, error)

	// GetInfo returns basic canary workload informations.
	GetCanaryInfo() Info

	// Delete delete canary resources
	Delete() error
}

type CanaryStrategy added in v0.1.0

type CanaryStrategy interface {
	StableInterface
	CanaryInterface
}

type Info

type Info struct {
	metav1.ObjectMeta
	// GVK is the GroupVersionKind of the workload.
	schema.GroupVersionKind
	// Status is the status of the workload.
	Status Status
}

workload info

func NewInfoFrom added in v0.1.0

func NewInfoFrom(cluster string, gvk schema.GroupVersionKind, obj client.Object, status Status) Info

func (Info) APIStatus added in v0.1.0

func (Info) CheckPartitionReady added in v0.1.0

func (o Info) CheckPartitionReady(partiton int32) bool

func (Info) DeepCopy added in v0.1.0

func (o Info) DeepCopy() Info

func (Info) NamespacedName added in v0.1.0

func (o Info) NamespacedName() types.NamespacedName

func (Info) String added in v0.1.0

func (o Info) String() string

type Interface

type Interface interface {
	// GetInfo returns basic workload informations.
	GetInfo() Info

	// IsWaitingRollout returns if the workload is waiting for rollout.
	IsWaitingRollout() bool

	// UpdateOnConflict try its best to updates the workload on conflict.
	UpdateOnConflict(ctx context.Context, modifyFunc func(obj client.Object) error) error

	// CanaryStrategy returns an interface for managing the canary strategy process.
	CanaryStrategy() (CanaryStrategy, error)

	// BatchStrategy returns an interface for managing the batch strategy process.
	BatchStrategy() BatchStrategy
}

Interface is the interface for workload

type Set

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

func NewWorkloadSet

func NewWorkloadSet(workloads ...Interface) *Set

func (*Set) Get

func (s *Set) Get(cluster, name string) Interface

func (*Set) ToSlice

func (s *Set) ToSlice() []Interface

type StableInterface added in v0.1.0

type StableInterface interface {
	// Initialize initializes the stable workload.
	// It claims the stable workload is in canary release process controlled by rolloutRun
	Initialize(rollout, rolloutRun string) error

	// GetStableInfo returns basic stable workload informations.
	GetStableInfo() Info

	// Finalize finalizes the stable workload.
	Finalize() error
}

type Status added in v0.1.0

type Status struct {
	// ObservedGeneration is the most recent generation observed for this workload.
	ObservedGeneration int64
	// StableRevision is the old stable revision used to generate pods.
	StableRevision string
	// UpdatedRevision is the updated template revision used to generate pods.
	UpdatedRevision string
	// Replicas is the desired number of pods targeted by workload
	Replicas int32
	// UpdatedReplicas is the number of pods targeted by workload that have the updated template spec.
	UpdatedReplicas int32
	// UpdatedReadyReplicas is the number of ready pods targeted by workload that have the updated template spec.
	UpdatedReadyReplicas int32
	// UpdatedAvailableReplicas is the number of service available pods targeted by workload that have the updated template spec.
	UpdatedAvailableReplicas int32
}

workload status

type WorkloadMatcher

type WorkloadMatcher interface {
	Matches(cluster, name string, label map[string]string) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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