utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ConditionUpdatePeriodBackOff = 30 * time.Second

Variables

View Source
var (
	UpdateOpsLifecycleAdapter  = &CollaSetUpdateOpsLifecycleAdapter{}
	ScaleInOpsLifecycleAdapter = &CollaSetScaleInOpsLifecycleAdapter{}
)
View Source
var (
	// ActiveExpectations is used to check the cache in informer is updated, before reconciling.
	ActiveExpectations *expectations.ActiveExpectations
)

Functions

func AddOrUpdateCondition

func AddOrUpdateCondition(status *appsv1alpha1.CollaSetStatus, conditionType appsv1alpha1.CollaSetConditionType, err error, reason, message string)

func ApplyPatchFromRevision

func ApplyPatchFromRevision(pod *corev1.Pod, revision *appsv1.ControllerRevision) (*corev1.Pod, error)

func CollectPodInstanceID

func CollectPodInstanceID(pods []*PodWrapper) map[int]struct{}

func ComparePod

func ComparePod(l, r *corev1.Pod) bool

func ExtractPvcTmpName

func ExtractPvcTmpName(cls *appsv1alpha1.CollaSet, pvc *corev1.PersistentVolumeClaim) (string, error)

func GetCondition

GetCondition returns a inplace set condition with the provided type if it exists.

func GetPodFromRevision

func GetPodFromRevision(revision *appsv1.ControllerRevision) (*corev1.Pod, error)

func GetPodInstanceID

func GetPodInstanceID(pod *corev1.Pod) (int, error)

func GetPodRevisionPatch

func GetPodRevisionPatch(revision *appsv1.ControllerRevision) ([]byte, error)

func GetPodsPrefix

func GetPodsPrefix(controllerName string) string

func InitExpectations

func InitExpectations(c client.Client)

func IsPodUpdatedRevision

func IsPodUpdatedRevision(pod *corev1.Pod, revision string) bool

func NewPodFrom

func NewPodFrom(owner metav1.Object, ownerRef *metav1.OwnerReference, revision *appsv1.ControllerRevision, updateFn ...func(*corev1.Pod) error) (*corev1.Pod, error)

func PatchToPod

func PatchToPod(currentRevisionPod, updateRevisionPod, currentPod *corev1.Pod) (*corev1.Pod, error)

PatchToPod Use three-way merge to get a updated pod.

func PvcTmpHash

func PvcTmpHash(pvc *corev1.PersistentVolumeClaim) (string, error)

func PvcTmpHashMapping

func PvcTmpHashMapping(pvcTmps []corev1.PersistentVolumeClaim) (map[string]string, error)

func RemoveCondition

func RemoveCondition(status *appsv1alpha1.CollaSetStatus, condType appsv1alpha1.CollaSetConditionType)

RemoveCondition removes the condition with the provided type from the replicaset status.

func SetCondition

func SetCondition(status *appsv1alpha1.CollaSetStatus, condition *appsv1alpha1.CollaSetCondition)

SetCondition adds/replaces the given condition in the replicaset status. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

Types

type CollaSetScaleInOpsLifecycleAdapter

type CollaSetScaleInOpsLifecycleAdapter struct {
}

CollaSetScaleInOpsLifecycleAdapter tells PodOpsLifecycle the basic workload scaling in ops info

func (*CollaSetScaleInOpsLifecycleAdapter) AllowMultiType

func (a *CollaSetScaleInOpsLifecycleAdapter) AllowMultiType() bool

AllowMultiType indicates whether multiple IDs which have the same Type are allowed

func (*CollaSetScaleInOpsLifecycleAdapter) GetID

GetID indicates ID of one PodOpsLifecycle

func (*CollaSetScaleInOpsLifecycleAdapter) GetType

GetType indicates type for an Operator

func (*CollaSetScaleInOpsLifecycleAdapter) WhenBegin

WhenBegin will be executed when begin a lifecycle

func (*CollaSetScaleInOpsLifecycleAdapter) WhenFinish

WhenFinish will be executed when finish a lifecycle

type CollaSetUpdateOpsLifecycleAdapter

type CollaSetUpdateOpsLifecycleAdapter struct {
}

CollaSetUpdateOpsLifecycleAdapter tells PodOpsLifecycle the basic workload update ops info

func (*CollaSetUpdateOpsLifecycleAdapter) AllowMultiType

func (a *CollaSetUpdateOpsLifecycleAdapter) AllowMultiType() bool

AllowMultiType indicates whether multiple IDs which have the same Type are allowed

func (*CollaSetUpdateOpsLifecycleAdapter) GetID

GetID indicates ID of one PodOpsLifecycle

func (*CollaSetUpdateOpsLifecycleAdapter) GetType

GetType indicates type for an Operator

func (*CollaSetUpdateOpsLifecycleAdapter) WhenBegin

WhenBegin will be executed when begin a lifecycle

func (*CollaSetUpdateOpsLifecycleAdapter) WhenFinish

WhenFinish will be executed when finish a lifecycle

type PodWrapper

type PodWrapper struct {
	*corev1.Pod
	ID            int
	ContextDetail *appsv1alpha1.ContextDetail

	PlaceHolder bool
	// TODO ToExclude
	ToDelete bool
}

type RelatedResources

type RelatedResources struct {
	Revisions       []*appsv1.ControllerRevision
	CurrentRevision *appsv1.ControllerRevision
	UpdatedRevision *appsv1.ControllerRevision
	ExistingPvcs    []*corev1.PersistentVolumeClaim

	PDGetter utilspoddecoration.Getter

	NewStatus *appsv1alpha1.CollaSetStatus
}

Jump to

Keyboard shortcuts

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