workload

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 9 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 CheckPartitionReady

func CheckPartitionReady(status rolloutv1alpha1.RolloutWorkloadStatus, partiton int32) bool

func GetClusterFromLabel

func GetClusterFromLabel(labels map[string]string) string

Types

type Info

type Info struct {
	Cluster   string
	Namespace string
	Name      string
	GVK       schema.GroupVersionKind
	Labels    map[string]string
}

func NewInfo

func NewInfo(cluster string, gvk schema.GroupVersionKind, obj client.Object) Info

type Interface

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

	// GetStatus returns current workload status
	GetStatus() rolloutv1alpha1.RolloutWorkloadStatus

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

	// 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)

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

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) Matches

func (s *Set) Matches(match *rolloutv1alpha1.ResourceMatch) []Interface

func (*Set) ToSlice

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

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