resourcekeeper

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MarkWithProbability optimize ResourceTracker gc for legacy resource by reducing the frequency of outdated rt check
	MarkWithProbability = 0.1
)
View Source
var MaxDispatchConcurrent = 10

MaxDispatchConcurrent is the max dispatch concurrent number

Functions

This section is empty.

Types

type DeleteOption

type DeleteOption interface {
	ApplyToDeleteConfig(*deleteConfig)
}

DeleteOption option for delete

type DisableGCComponentRevisionOption

type DisableGCComponentRevisionOption struct{}

DisableGCComponentRevisionOption disable the component revision gc process this option should be switched on when application workflow is suspending/terminating

func (DisableGCComponentRevisionOption) ApplyToGCConfig

func (option DisableGCComponentRevisionOption) ApplyToGCConfig(cfg *gcConfig)

ApplyToGCConfig apply change to gc config

type DisableLegacyGCOption

type DisableLegacyGCOption struct{}

DisableLegacyGCOption disable garbage collect legacy resourcetrackers

func (DisableLegacyGCOption) ApplyToGCConfig

func (option DisableLegacyGCOption) ApplyToGCConfig(cfg *gcConfig)

ApplyToGCConfig apply change to gc config

type DisableMarkStageGCOption

type DisableMarkStageGCOption struct{}

DisableMarkStageGCOption disable the mark stage in gc process (no rt will be marked to be deleted) this option should be switched on when application workflow is suspending/terminating since workflow is not finished so outdated versions should be kept

func (DisableMarkStageGCOption) ApplyToGCConfig

func (option DisableMarkStageGCOption) ApplyToGCConfig(cfg *gcConfig)

ApplyToGCConfig apply change to gc config

type DispatchOption

type DispatchOption interface {
	ApplyToDispatchConfig(*dispatchConfig)
}

DispatchOption option for dispatch

type GCOption

type GCOption interface {
	ApplyToGCConfig(*gcConfig)
}

GCOption option for gc

type GarbageCollectStrategyOption

type GarbageCollectStrategyOption v1alpha1.GarbageCollectStrategy

GarbageCollectStrategyOption apply garbage collect strategy to resourcetracker recording

func (GarbageCollectStrategyOption) ApplyToDeleteConfig

func (option GarbageCollectStrategyOption) ApplyToDeleteConfig(cfg *deleteConfig)

ApplyToDeleteConfig apply change to delete config

func (GarbageCollectStrategyOption) ApplyToDispatchConfig

func (option GarbageCollectStrategyOption) ApplyToDispatchConfig(cfg *dispatchConfig)

ApplyToDispatchConfig apply change to dispatch config

type MetaOnlyOption

type MetaOnlyOption struct{}

MetaOnlyOption record only meta part in resourcetracker, which disables the configuration-drift-prevention

func (MetaOnlyOption) ApplyToDispatchConfig

func (option MetaOnlyOption) ApplyToDispatchConfig(cfg *dispatchConfig)

ApplyToDispatchConfig apply change to dispatch config

type PassiveGCOption

type PassiveGCOption struct{}

PassiveGCOption disable the active gc for outdated versions. Old versioned resourcetracker will not be recycled except all of their managed resources have already been deleted or controlled by later resourcetrackers.

func (PassiveGCOption) ApplyToGCConfig

func (option PassiveGCOption) ApplyToGCConfig(cfg *gcConfig)

ApplyToGCConfig apply change to gc config

type ResourceKeeper

type ResourceKeeper interface {
	Dispatch(context.Context, []*unstructured.Unstructured, ...DispatchOption) error
	Delete(context.Context, []*unstructured.Unstructured, ...DeleteOption) error
	GarbageCollect(context.Context, ...GCOption) (bool, []v1beta1.ManagedResource, error)
	StateKeep(context.Context) error

	DispatchComponentRevision(context.Context, *v1.ControllerRevision) error
	DeleteComponentRevision(context.Context, *v1.ControllerRevision) error
}

ResourceKeeper handler for dispatching and deleting resources

func NewResourceKeeper

func NewResourceKeeper(ctx context.Context, cli client.Client, app *v1beta1.Application) (_ ResourceKeeper, err error)

NewResourceKeeper create a handler for dispatching and deleting resources

type SkipRTOption

type SkipRTOption struct{}

SkipRTOption skip the rt recording during dispatch/delete resources, which means the resource will not be controlled by application resourcetracker

func (SkipRTOption) ApplyToDeleteConfig

func (option SkipRTOption) ApplyToDeleteConfig(cfg *deleteConfig)

ApplyToDeleteConfig apply change to delete config

func (SkipRTOption) ApplyToDispatchConfig

func (option SkipRTOption) ApplyToDispatchConfig(cfg *dispatchConfig)

ApplyToDispatchConfig apply change to dispatch config

type UseRootOption

type UseRootOption struct{}

UseRootOption let the recording and management of target resource belongs to the RootRT instead of VersionedRT. This will let the resource be alive as long as the application is still alive.

func (UseRootOption) ApplyToDeleteConfig

func (option UseRootOption) ApplyToDeleteConfig(cfg *deleteConfig)

ApplyToDeleteConfig apply change to delete config

func (UseRootOption) ApplyToDispatchConfig

func (option UseRootOption) ApplyToDispatchConfig(cfg *dispatchConfig)

ApplyToDispatchConfig apply change to dispatch config

Jump to

Keyboard shortcuts

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