uniteddeployment

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 37 Imported by: 2

Documentation

Index

Constants

View Source
const ControllerRevisionHashLabel = "controller.kubernetes.io/hash"

ControllerRevisionHashLabel is the label used to indicate the hash value of a ControllerRevision's Data.

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new UnitedDeployment Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller and Start it when the Manager is Started.

func GetAllocatedReplicas

func GetAllocatedReplicas(nameToSubset *map[string]*Subset, ud *appsv1alpha1.UnitedDeployment) (*map[string]int32, error)

GetAllocatedReplicas returns a mapping from subset to next replicas. Next replicas is allocated by replicasAllocator, which will consider the current replicas of each subset and new replicas indicated from UnitedDeployment.Spec.Topology.Subsets.

func GetUnitedDeploymentCondition

GetUnitedDeploymentCondition returns the condition with the provided type.

func NewUnitedDeploymentCondition

func NewUnitedDeploymentCondition(condType appsv1alpha1.UnitedDeploymentConditionType, status corev1.ConditionStatus, reason, message string) *appsv1alpha1.UnitedDeploymentCondition

NewUnitedDeploymentCondition creates a new UnitedDeployment condition.

func ParseSubsetReplicas

func ParseSubsetReplicas(udReplicas int32, subsetReplicas intstr.IntOrString) (int32, error)

ParseSubsetReplicas parses the subsetReplicas, and returns the replicas number depending on the sum replicas.

func RemoveUnitedDeploymentCondition

func RemoveUnitedDeploymentCondition(status *appsv1alpha1.UnitedDeploymentStatus, condType appsv1alpha1.UnitedDeploymentConditionType)

RemoveUnitedDeploymentCondition removes the UnitedDeployment condition with the provided type.

func SetUnitedDeploymentCondition

func SetUnitedDeploymentCondition(status *appsv1alpha1.UnitedDeploymentStatus, condition *appsv1alpha1.UnitedDeploymentCondition)

SetUnitedDeploymentCondition updates the UnitedDeployment to include the provided condition. If the condition that we are about to add already exists and has the same status, reason and message then we are not going to update.

Types

type ControlInterface

type ControlInterface interface {
	// GetAllSubsets returns the subsets which are managed by the UnitedDeployment.
	GetAllSubsets(ud *appsv1alpha1.UnitedDeployment, updatedRevision string) ([]*Subset, error)
	// CreateSubset creates the subset depending on the inputs.
	CreateSubset(ud *appsv1alpha1.UnitedDeployment, unit string, revision string, replicas, partition int32) error
	// UpdateSubset updates the target subset with the input information.
	UpdateSubset(subSet *Subset, ud *appsv1alpha1.UnitedDeployment, revision string, replicas, partition int32) error
	// UpdateSubset is used to delete the input subset.
	DeleteSubset(*Subset) error
	// GetSubsetFailure extracts the subset failure message to expose on UnitedDeployment status.
	GetSubsetFailure(*Subset) *string
	// IsExpected check the subset is the expected revision
	IsExpected(subSet *Subset, revision string) bool
}

ControlInterface defines the interface that UnitedDeployment uses to list, create, update, and delete Subsets.

type ReconcileUnitedDeployment

type ReconcileUnitedDeployment struct {
	client.Client
	// contains filtered or unexported fields
}

ReconcileUnitedDeployment reconciles a UnitedDeployment object

func (*ReconcileUnitedDeployment) Reconcile

Reconcile reads that state of the cluster for a UnitedDeployment object and makes changes based on the state read and what is in the UnitedDeployment.Spec

type ResourceRef

type ResourceRef struct {
	Resources []metav1.Object
}

ResourceRef stores the Subset resource it represents.

type Subset

type Subset struct {
	metav1.ObjectMeta

	Spec   SubsetSpec
	Status SubsetStatus
}

Subset stores the details of a subset resource owned by one UnitedDeployment.

type SubsetControl added in v0.4.0

type SubsetControl struct {
	client.Client
	// contains filtered or unexported fields
}

SubsetControl provides subset operations of MutableSet.

func (*SubsetControl) CreateSubset added in v0.4.0

func (m *SubsetControl) CreateSubset(ud *alpha1.UnitedDeployment, subsetName string, revision string, replicas, partition int32) error

CreateSubset creates the Subset depending on the inputs.

func (*SubsetControl) DeleteSubset added in v0.4.0

func (m *SubsetControl) DeleteSubset(subSet *Subset) error

DeleteSubset is called to delete the subset. The target Subset workload can be found with the input subset.

func (*SubsetControl) GetAllSubsets added in v0.4.0

func (m *SubsetControl) GetAllSubsets(ud *alpha1.UnitedDeployment, updatedRevision string) (subSets []*Subset, err error)

GetAllSubsets returns all of subsets owned by the UnitedDeployment.

func (*SubsetControl) GetSubsetFailure added in v0.4.0

func (m *SubsetControl) GetSubsetFailure(subset *Subset) *string

GetSubsetFailure return the error message extracted form Subset workload status conditions.

func (*SubsetControl) IsExpected added in v0.4.0

func (m *SubsetControl) IsExpected(subSet *Subset, revision string) bool

IsExpected checks the subset is expected revision or not.

func (*SubsetControl) UpdateSubset added in v0.4.0

func (m *SubsetControl) UpdateSubset(subset *Subset, ud *alpha1.UnitedDeployment, revision string, replicas, partition int32) error

UpdateSubset is used to update the subset. The target Subset workload can be found with the input subset.

type SubsetSpec

type SubsetSpec struct {
	SubsetName     string
	Replicas       int32
	UpdateStrategy SubsetUpdateStrategy
	SubsetRef      ResourceRef
}

SubsetSpec stores the spec details of the Subset

type SubsetStatus

type SubsetStatus struct {
	ObservedGeneration   int64
	Replicas             int32
	ReadyReplicas        int32
	UpdatedReplicas      int32
	UpdatedReadyReplicas int32
}

SubsetStatus stores the observed state of the Subset.

type SubsetUpdateStrategy

type SubsetUpdateStrategy struct {
	Partition int32
}

SubsetUpdateStrategy stores the strategy detail of the Subset.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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