Documentation ¶
Index ¶
- Constants
- type APIOrderedDeleter
- type ChildResourceDeleter
- type ChildResourceDeleterFunc
- type ChildResourcePatcher
- type ChildResourcePatcherChain
- type ChildResourcePatcherFunc
- type DefaultingAnnotationRemover
- type Engine
- type EngineFunc
- type LabelPropagator
- type NamespacePatcher
- type NopEngine
- type OwnerReferenceAdder
- type ParentLabelSetAdder
- type Reconciler
- type ReconcilerOption
- func WithChildResourceDeleter(d ChildResourceDeleter) ReconcilerOption
- func WithChildResourcePatcher(op ...ChildResourcePatcher) ReconcilerOption
- func WithEngine(eng Engine) ReconcilerOption
- func WithFinalizer(f rresource.Finalizer) ReconcilerOption
- func WithLogger(l logging.Logger) ReconcilerOption
- func WithLongWait(d time.Duration) ReconcilerOption
- func WithShortWait(d time.Duration) ReconcilerOption
Constants ¶
const ( RemoveDefaultAnnotationsKey = "templatestacks.crossplane.io/remove-defaulting-annotations" RemoveDefaultAnnotationsTrueValue = "true" DeletionPriorityAnnotationKey = "templatestacks.crossplane.io/deletion-priority" DeletionPriorityAnnotationZeroValue = "0" )
Constants used for annotations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIOrderedDeleter ¶
type APIOrderedDeleter struct {
// contains filtered or unexported fields
}
APIOrderedDeleter deletes the child resources in an order that is determined by their priority noted in the child resource annotation. The child resources with higher priority will be deleted first and their deletion will block the lower priority ones.
func NewAPIOrderedDeleter ¶
func NewAPIOrderedDeleter(c client.Client) *APIOrderedDeleter
NewAPIOrderedDeleter returns a new *APIOrderedDeleter.
func (*APIOrderedDeleter) Delete ¶
func (d *APIOrderedDeleter) Delete(ctx context.Context, cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Delete executes an ordered deletion of child resources depending on their deletion priority.
type ChildResourceDeleter ¶
type ChildResourceDeleter interface {
Delete(ctx context.Context, cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
}
ChildResourceDeleter deletes the child resources.
type ChildResourceDeleterFunc ¶
type ChildResourceDeleterFunc func(ctx context.Context, cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
ChildResourceDeleterFunc makes it easier to provide only a function as ChildResourceDeleter
func (ChildResourceDeleterFunc) Delete ¶
func (pre ChildResourceDeleterFunc) Delete(ctx context.Context, cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Delete calls the ChildResourceDeleterFunc function.
type ChildResourcePatcher ¶
type ChildResourcePatcher interface {
Patch(resource.ParentResource, []resource.ChildResource) ([]resource.ChildResource, error)
}
ChildResourcePatcher operates on the resources rendered by the templating engine.
type ChildResourcePatcherChain ¶
type ChildResourcePatcherChain []ChildResourcePatcher
ChildResourcePatcherChain makes it easier to provide a list of ChildResourcePatcher to be called in order.
func (ChildResourcePatcherChain) Patch ¶
func (pre ChildResourcePatcherChain) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch calls the ChildResourcePatcherChain functions in order.
type ChildResourcePatcherFunc ¶
type ChildResourcePatcherFunc func(resource.ParentResource, []resource.ChildResource) ([]resource.ChildResource, error)
ChildResourcePatcherFunc makes it easier to provide only a function as ChildResourcePatcher
func (ChildResourcePatcherFunc) Patch ¶
func (pre ChildResourcePatcherFunc) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch calls the ChildResourcePatcherFunc function.
type DefaultingAnnotationRemover ¶
type DefaultingAnnotationRemover struct{}
DefaultingAnnotationRemover removes the defaulting annotation on the resources if it is requested through the special annotation.
func NewDefaultingAnnotationRemover ¶
func NewDefaultingAnnotationRemover() DefaultingAnnotationRemover
NewDefaultingAnnotationRemover returns a new DefaultingAnnotationRemover
func (DefaultingAnnotationRemover) Patch ¶
func (lo DefaultingAnnotationRemover) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch patches the child resources with information in resource.ParentResource.
type Engine ¶
type Engine interface {
Run(resource.ParentResource) ([]resource.ChildResource, error)
}
Engine is used as main generation engine by the templating reconciler. Its input is typically a Custom Resource instance and output is various Kubernetes objects generated by the given implementation of the Engine.
type EngineFunc ¶
type EngineFunc func(resource.ParentResource) ([]resource.ChildResource, error)
EngineFunc used for supplying only one function as templating engine.
func (EngineFunc) Run ¶
func (t EngineFunc) Run(cr resource.ParentResource) ([]resource.ChildResource, error)
Run calls the EngineFunc function.
type LabelPropagator ¶
type LabelPropagator struct{}
LabelPropagator propagates all the labels that the parent resource has down to all child resources.
func NewLabelPropagator ¶
func NewLabelPropagator() LabelPropagator
NewLabelPropagator returns a new LabelPropagator
func (LabelPropagator) Patch ¶
func (lo LabelPropagator) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch patches the child resources with information in resource.ParentResource.
type NamespacePatcher ¶
type NamespacePatcher struct{}
NamespacePatcher patches the child resources whose metadata.namespace is empty with namespace of the parent resource. Note that we don't need to know whether child resource is cluster-scoped or not because even though it is, the creation goes through with no error, namespace being skipped.
func NewNamespacePatcher ¶
func NewNamespacePatcher() NamespacePatcher
NewNamespacePatcher returns a new NamespacePatcher
func (NamespacePatcher) Patch ¶
func (lo NamespacePatcher) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch patches the child resources with information in resource.ParentResource.
type NopEngine ¶
type NopEngine struct{}
NopEngine is a no-op templating engine.
func (*NopEngine) Run ¶
func (n *NopEngine) Run(_ resource.ParentResource) ([]resource.ChildResource, error)
Run does nothing.
type OwnerReferenceAdder ¶
type OwnerReferenceAdder struct{}
OwnerReferenceAdder adds owner reference of resource.ParentResource to all resource.ChildResources except the Providers since their deletion should be delayed until all resources refer to them are deleted.
func NewOwnerReferenceAdder ¶
func NewOwnerReferenceAdder() OwnerReferenceAdder
NewOwnerReferenceAdder returns a new *OwnerReferenceAdder
func (OwnerReferenceAdder) Patch ¶
func (lo OwnerReferenceAdder) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch patches the child resources with information in resource.ParentResource.
type ParentLabelSetAdder ¶
type ParentLabelSetAdder struct{}
ParentLabelSetAdder adds parent labels to the child resources. See https://github.com/crossplane/crossplane/blob/master/design/one-pager-stack-relationship-labels.md
func NewParentLabelSetAdder ¶
func NewParentLabelSetAdder() ParentLabelSetAdder
NewParentLabelSetAdder returns a new ParentLabelSetAdder
func (ParentLabelSetAdder) Patch ¶
func (lo ParentLabelSetAdder) Patch(cr resource.ParentResource, list []resource.ChildResource) ([]resource.ChildResource, error)
Patch patches the child resources with information in resource.ParentResource.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler is used to reconcile an arbitrary CRD whose GroupVersionKind is supplied.
func NewReconciler ¶
func NewReconciler(m manager.Manager, of schema.GroupVersionKind, options ...ReconcilerOption) *Reconciler
NewReconciler returns a new templating reconciler that will reconcile given GroupVersionKind.
type ReconcilerOption ¶
type ReconcilerOption func(*Reconciler)
ReconcilerOption is used to provide necessary changes to templating reconciler configuration.
func WithChildResourceDeleter ¶
func WithChildResourceDeleter(d ChildResourceDeleter) ReconcilerOption
WithChildResourceDeleter returns a ReconcilerOption that changes the ChildResourceDeleter.
func WithChildResourcePatcher ¶
func WithChildResourcePatcher(op ...ChildResourcePatcher) ReconcilerOption
WithChildResourcePatcher returns a ReconcilerOption that changes the ChildResourcePatchers.
func WithEngine ¶
func WithEngine(eng Engine) ReconcilerOption
WithEngine returns a ReconcilerOption that changes the templating engine.
func WithFinalizer ¶
func WithFinalizer(f rresource.Finalizer) ReconcilerOption
WithFinalizer returns a ReconcilerOption that changes the Finalizer.
func WithLogger ¶
func WithLogger(l logging.Logger) ReconcilerOption
WithLogger returns a ReconcilerOption that changes the logger.
func WithLongWait ¶
func WithLongWait(d time.Duration) ReconcilerOption
WithLongWait returns a ReconcilerOption that changes the wait duration that determines after how much time another reconcile should be triggered after a successful pass.
func WithShortWait ¶
func WithShortWait(d time.Duration) ReconcilerOption
WithShortWait returns a ReconcilerOption that changes the wait duration that determines after how much time another reconcile should be triggered after an error pass.