resourcekeeper

package
v1.5.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllowCrossNamespaceResource indicates whether application can apply resources into other namespaces
	AllowCrossNamespaceResource = true
	// AllowResourceTypes if not empty, application can only apply resources with specified types
	AllowResourceTypes = ""
)
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

func ApplyStrategies added in v1.4.0

func ApplyStrategies(ctx context.Context, h *resourceKeeper, manifest *unstructured.Unstructured) (*unstructured.Unstructured, error)

ApplyStrategies will generate manifest with applyOnceStrategy

Types

type CreatorOption added in v1.4.0

type CreatorOption struct {
	Creator common.ResourceCreatorRole
}

CreatorOption set the creator of the resource

func (CreatorOption) ApplyToDispatchConfig added in v1.4.0

func (option CreatorOption) ApplyToDispatchConfig(cfg *dispatchConfig)

ApplyToDispatchConfig apply change to dispatch config

type DeleteOption

type DeleteOption interface {
	ApplyToDeleteConfig(*deleteConfig)
}

DeleteOption option for delete

type DependencyGCOption added in v1.4.0

type DependencyGCOption struct{}

DependencyGCOption recycle the resource in the order of reverse dependency

func (DependencyGCOption) ApplyToGCConfig added in v1.4.0

func (option DependencyGCOption) ApplyToGCConfig(cfg *gcConfig)

ApplyToGCConfig apply change to gc config

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 NamespaceAdmissionHandler added in v1.3.0

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

NamespaceAdmissionHandler defines the handler to validate if the resource namespace is valid to be dispatch/delete

func (*NamespaceAdmissionHandler) Validate added in v1.3.0

Validate check if cross namespace is available

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 ResourceAdmissionHandler added in v1.3.0

type ResourceAdmissionHandler interface {
	Validate(ctx context.Context, manifests []*unstructured.Unstructured) error
}

ResourceAdmissionHandler defines the handler to validate the admission of resource operation

type ResourceKeeper

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

	DispatchComponentRevision(context.Context, *appsv1.ControllerRevision) error
	DeleteComponentRevision(context.Context, *appsv1.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 ResourceTypeAdmissionHandler added in v1.3.0

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

ResourceTypeAdmissionHandler defines the handler to validate if the resource type is valid to be dispatch/delete

func (*ResourceTypeAdmissionHandler) Validate added in v1.3.0

Validate check if resource type is valid

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