Documentation ¶
Index ¶
- Variables
- func ApplyStrategies(ctx context.Context, h *resourceKeeper, manifest *unstructured.Unstructured, ...) (*unstructured.Unstructured, error)
- type CreatorOption
- type DeleteOption
- type DependencyGCOption
- type DisableGCComponentRevisionOption
- type DisableLegacyGCOption
- type DisableMarkStageGCOption
- type DispatchOption
- type GCOption
- type GarbageCollectStrategyOption
- type MetaOnlyOption
- type NamespaceAdmissionHandler
- type PassiveGCOption
- type ResourceAdmissionHandler
- type ResourceKeeper
- type ResourceTypeAdmissionHandler
- type SkipGCOption
- type UseRootOption
Constants ¶
This section is empty.
Variables ¶
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 = "" )
var (
// MarkWithProbability optimize ResourceTracker gc for legacy resource by reducing the frequency of outdated rt check
MarkWithProbability = 0.1
)
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, matchedAffectStage v1alpha1.ApplyOnceAffectStrategy) (*unstructured.Unstructured, error)
ApplyStrategies will generate manifest with applyOnceStrategy
Types ¶
type CreatorOption ¶ added in v1.4.0
type CreatorOption struct {
Creator string
}
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 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
func (h *NamespaceAdmissionHandler) Validate(ctx context.Context, manifests []*unstructured.Unstructured) error
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
func (h *ResourceTypeAdmissionHandler) Validate(ctx context.Context, manifests []*unstructured.Unstructured) error
Validate check if resource type is valid
type SkipGCOption ¶ added in v1.5.0
type SkipGCOption struct{}
SkipGCOption marks the recorded resource to skip gc
func (SkipGCOption) ApplyToDeleteConfig ¶ added in v1.5.0
func (option SkipGCOption) ApplyToDeleteConfig(cfg *deleteConfig)
ApplyToDeleteConfig apply change to delete config
func (SkipGCOption) ApplyToDispatchConfig ¶ added in v1.5.0
func (option SkipGCOption) 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