templating

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
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

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

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

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

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

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

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

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

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

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

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

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.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)

Reconcile is called by controller-runtime for reconciliation.

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.

Jump to

Keyboard shortcuts

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