synccontrol

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: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplaceNewPodIDContextDataKey    = "ReplaceNewPodID"
	ReplaceOriginPodIDContextDataKey = "ReplaceOriginPodID"
)
View Source
const (
	ScaleInContextDataKey = "ScaleIn"
)

Variables

This section is empty.

Functions

func FilterOutPlaceHolderPodWrappers

func FilterOutPlaceHolderPodWrappers(pods []*collasetutils.PodWrapper) []*collasetutils.PodWrapper

func RecreatePod

func RecreatePod(collaSet *appsv1alpha1.CollaSet, podInfo *PodUpdateInfo, podControl podcontrol.Interface, recorder record.EventRecorder) error

func RegisterInPlaceOnlyUpdater

func RegisterInPlaceOnlyUpdater(podUpdater PodUpdater)

Types

type ActivePodsForDeletion

type ActivePodsForDeletion []*collasetutils.PodWrapper

func (ActivePodsForDeletion) Len

func (s ActivePodsForDeletion) Len() int

func (ActivePodsForDeletion) Less

func (s ActivePodsForDeletion) Less(i, j int) bool

func (ActivePodsForDeletion) Swap

func (s ActivePodsForDeletion) Swap(i, j int)

type ContainerStatus

type ContainerStatus struct {
	LatestImage string `json:"latestImage,omitempty"`
	LastImageID string `json:"lastImageID,omitempty"`
}

type GenericPodUpdater

type GenericPodUpdater struct {
	*appsv1alpha1.CollaSet
	PodControl podcontrol.Interface
	Recorder   record.EventRecorder
	client.Client
}

func (*GenericPodUpdater) BeginUpdatePod

func (u *GenericPodUpdater) BeginUpdatePod(_ context.Context, resources *collasetutils.RelatedResources, podCh chan *PodUpdateInfo) (bool, error)

func (*GenericPodUpdater) FilterAllowOpsPods

func (u *GenericPodUpdater) FilterAllowOpsPods(_ context.Context, candidates []*PodUpdateInfo, ownedIDs map[int]*appsv1alpha1.ContextDetail, _ *collasetutils.RelatedResources, podCh chan *PodUpdateInfo) (*time.Duration, error)

func (*GenericPodUpdater) FinishUpdatePod

func (u *GenericPodUpdater) FinishUpdatePod(_ context.Context, podInfo *PodUpdateInfo) error

func (*GenericPodUpdater) Setup

func (u *GenericPodUpdater) Setup(client client.Client, cls *appsv1alpha1.CollaSet, podControl podcontrol.Interface, recorder record.EventRecorder)

type Interface

type Interface interface {
	SyncPods(
		ctx context.Context,
		instance *appsv1alpha1.CollaSet,
		resources *collasetutils.RelatedResources,
	) (bool, []*collasetutils.PodWrapper, map[int]*appsv1alpha1.ContextDetail, error)

	Scale(
		ctx context.Context,
		instance *appsv1alpha1.CollaSet,
		resources *collasetutils.RelatedResources,
		filteredPods []*collasetutils.PodWrapper,
		ownedIDs map[int]*appsv1alpha1.ContextDetail,
	) (bool, *time.Duration, error)

	Update(
		ctx context.Context,
		instance *appsv1alpha1.CollaSet,
		resources *collasetutils.RelatedResources,
		filteredPods []*collasetutils.PodWrapper,
		ownedIDs map[int]*appsv1alpha1.ContextDetail,
	) (bool, *time.Duration, error)
}

func NewRealSyncControl

func NewRealSyncControl(client client.Client, logger logr.Logger, podControl podcontrol.Interface, pvcControl pvccontrol.Interface, recorder record.EventRecorder) Interface

type PodStatus

type PodStatus struct {
	ContainerStates map[string]*ContainerStatus `json:"containerStates,omitempty"`
}

type PodUpdateInfo

type PodUpdateInfo struct {
	*utils.PodWrapper

	UpdatedPod *corev1.Pod

	InPlaceUpdateSupport bool
	OnlyMetadataChanged  bool

	// indicate if this pod has up-to-date revision from its owner, like CollaSet
	IsUpdatedRevision bool
	// carry the pod's current revision
	CurrentRevision *appsv1.ControllerRevision
	// carry the desired update revision
	UpdateRevision *appsv1.ControllerRevision

	// indicates effected PodDecorations changed
	PodDecorationChanged bool
	// indicate if the pvc template changed
	PvcTmpHashChanged bool

	CurrentPodDecorations map[string]*appsv1alpha1.PodDecoration
	UpdatedPodDecorations map[string]*appsv1alpha1.PodDecoration
	// contains filtered or unexported fields
}

type PodUpdater

type PodUpdater interface {
	Setup(client.Client, *appsv1alpha1.CollaSet, podcontrol.Interface, record.EventRecorder)
	FulfillPodUpdatedInfo(ctx context.Context, revision *appsv1.ControllerRevision, podUpdateInfo *PodUpdateInfo) error
	BeginUpdatePod(ctx context.Context, resources *collasetutils.RelatedResources, podCh chan *PodUpdateInfo) (bool, error)
	FilterAllowOpsPods(ctx context.Context, podToUpdate []*PodUpdateInfo, ownedIDs map[int]*appsv1alpha1.ContextDetail, resources *collasetutils.RelatedResources, podCh chan *PodUpdateInfo) (*time.Duration, error)
	UpgradePod(ctx context.Context, podInfo *PodUpdateInfo) error
	GetPodUpdateFinishStatus(ctx context.Context, podUpdateInfo *PodUpdateInfo) (bool, string, error)
	FinishUpdatePod(ctx context.Context, podInfo *PodUpdateInfo) error
}

type RealSyncControl

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

func (*RealSyncControl) Scale

func (*RealSyncControl) SyncPods

SyncPods is used to reclaim Pod instance ID

func (*RealSyncControl) Update

Jump to

Keyboard shortcuts

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