adapter

package
v1.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewPatchedObject

func CreateNewPatchedObject(patchInfo *runtime.RawExtension, set metav1.Object, newPatched metav1.Object) error

func PoolHasPatch

func PoolHasPatch(poolConfig *appsv1alpha1.Pool, set metav1.Object) bool

func StrategicMergeByPatches

func StrategicMergeByPatches(oldobj interface{}, patch *runtime.RawExtension, newPatched interface{}) error

Types

type Adapter

type Adapter interface {
	// NewResourceObject creates a empty pool object.
	NewResourceObject() runtime.Object
	// NewResourceListObject creates a empty pool list object.
	NewResourceListObject() runtime.Object
	// GetStatusObservedGeneration returns the observed generation of the pool.
	GetStatusObservedGeneration(pool metav1.Object) int64
	// GetDetails returns the replicas information of the pool status.
	GetDetails(pool metav1.Object) (replicasInfo ReplicasInfo, err error)
	// GetAvailableStatus returns the available condition status of the workload
	GetAvailableStatus(set metav1.Object) (conditionStatus corev1.ConditionStatus, err error)
	// GetPoolFailure returns failure information of the pool.
	GetPoolFailure() *string
	// ApplyPoolTemplate updates the pool to the latest revision.
	ApplyPoolTemplate(yas *alpha1.YurtAppSet, poolName, revision string, replicas int32, pool runtime.Object) error
	// IsExpected checks the pool is the expected revision or not.
	// If not, YurtAppSet will call ApplyPoolTemplate to update it.
	IsExpected(pool metav1.Object, revision string) bool
	// PostUpdate does some works after pool updated
	PostUpdate(yas *alpha1.YurtAppSet, pool runtime.Object, revision string) error
}

type DeploymentAdapter

type DeploymentAdapter struct {
	client.Client

	Scheme *runtime.Scheme
}

func (*DeploymentAdapter) ApplyPoolTemplate

func (a *DeploymentAdapter) ApplyPoolTemplate(yas *alpha1.YurtAppSet, poolName, revision string,
	replicas int32, obj runtime.Object) error

ApplyPoolTemplate updates the pool to the latest revision, depending on the DeploymentTemplate.

func (*DeploymentAdapter) GetAvailableStatus

func (a *DeploymentAdapter) GetAvailableStatus(obj metav1.Object) (conditionStatus corev1.ConditionStatus, err error)

GetAvailableStatus returns the available condition status of the workload

func (*DeploymentAdapter) GetDetails

func (a *DeploymentAdapter) GetDetails(obj metav1.Object) (ReplicasInfo, error)

GetDetails returns the replicas detail the pool needs.

func (*DeploymentAdapter) GetPoolFailure

func (a *DeploymentAdapter) GetPoolFailure() *string

GetPoolFailure returns the failure information of the pool. Deployment has no condition.

func (*DeploymentAdapter) GetStatusObservedGeneration

func (a *DeploymentAdapter) GetStatusObservedGeneration(obj metav1.Object) int64

GetStatusObservedGeneration returns the observed generation of the pool.

func (*DeploymentAdapter) IsExpected

func (a *DeploymentAdapter) IsExpected(obj metav1.Object, revision string) bool

IsExpected checks the pool is the expected revision or not. The revision label can tell the current pool revision.

func (*DeploymentAdapter) NewResourceListObject

func (a *DeploymentAdapter) NewResourceListObject() runtime.Object

NewResourceListObject creates a empty DeploymentList object.

func (*DeploymentAdapter) NewResourceObject

func (a *DeploymentAdapter) NewResourceObject() runtime.Object

NewResourceObject creates a empty Deployment object.

func (*DeploymentAdapter) PostUpdate

func (a *DeploymentAdapter) PostUpdate(yas *alpha1.YurtAppSet, obj runtime.Object, revision string) error

PostUpdate does some works after pool updated. Deployment will implement this method to clean stuck pods.

type ReplicasInfo

type ReplicasInfo struct {
	Replicas      int32
	ReadyReplicas int32
}

type StatefulSetAdapter

type StatefulSetAdapter struct {
	client.Client

	Scheme *runtime.Scheme
}

func (*StatefulSetAdapter) ApplyPoolTemplate

func (a *StatefulSetAdapter) ApplyPoolTemplate(yas *alpha1.YurtAppSet, poolName, revision string,
	replicas int32, obj runtime.Object) error

ApplyPoolTemplate updates the pool to the latest revision, depending on the StatefulSetTemplate.

func (*StatefulSetAdapter) GetAvailableStatus

func (a *StatefulSetAdapter) GetAvailableStatus(obj metav1.Object) (conditionStatus corev1.ConditionStatus, err error)

GetAvailableStatus returns the available condition status of the workload

func (*StatefulSetAdapter) GetDetails

func (a *StatefulSetAdapter) GetDetails(obj metav1.Object) (ReplicasInfo, error)

GetDetails returns the replicas detail the pool needs.

func (*StatefulSetAdapter) GetPoolFailure

func (a *StatefulSetAdapter) GetPoolFailure() *string

GetPoolFailure returns the failure information of the pool. StatefulSet has no condition.

func (*StatefulSetAdapter) GetStatusObservedGeneration

func (a *StatefulSetAdapter) GetStatusObservedGeneration(obj metav1.Object) int64

GetStatusObservedGeneration returns the observed generation of the pool.

func (*StatefulSetAdapter) IsExpected

func (a *StatefulSetAdapter) IsExpected(obj metav1.Object, revision string) bool

IsExpected checks the pool is the expected revision or not. The revision label can tell the current pool revision.

func (*StatefulSetAdapter) NewResourceListObject

func (a *StatefulSetAdapter) NewResourceListObject() runtime.Object

NewResourceListObject creates a empty StatefulSetList object.

func (*StatefulSetAdapter) NewResourceObject

func (a *StatefulSetAdapter) NewResourceObject() runtime.Object

NewResourceObject creates a empty StatefulSet object.

func (*StatefulSetAdapter) PostUpdate

func (a *StatefulSetAdapter) PostUpdate(yas *alpha1.YurtAppSet, obj runtime.Object, revision string) error

PostUpdate does some works after pool updated. StatefulSet will implement this method to clean stuck pods.

Jump to

Keyboard shortcuts

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