definition

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package definition manages the lifecycle of XR controllers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnqueueCompositeResources added in v1.17.0

func EnqueueCompositeResources(of resource.CompositeKind, c client.Reader, log logging.Logger) handler.Funcs

EnqueueCompositeResources enqueues reconciles for all XRs that reference an updated composed resource.

func EnqueueForCompositionRevision added in v1.17.0

func EnqueueForCompositionRevision(of resource.CompositeKind, c client.Reader, log logging.Logger) handler.Funcs

EnqueueForCompositionRevision enqueues reconciles for all XRs that will use a newly created CompositionRevision.

func IndexCompositeResourcesRefs added in v1.14.0

func IndexCompositeResourcesRefs(o client.Object) []string

IndexCompositeResourcesRefs assumes the passed object is a composite. It returns keys for every composed resource referenced in the composite.

func IsCompositeResourceCRD added in v1.17.0

func IsCompositeResourceCRD() resource.PredicateFn

IsCompositeResourceCRD accepts any CustomResourceDefinition that represents a Composite Resource.

func NewClientApplicator added in v1.17.0

func NewClientApplicator(c client.Client) resource.ClientApplicator

NewClientApplicator returns a ClientApplicator suitable for use by the definition controller.

func Setup

Setup adds a controller that reconciles CompositeResourceDefinitions by defining a composite resource and starting a controller to reconcile it.

Types

type CRDRenderFn

A CRDRenderFn renders a CompositeResourceDefinition's corresponding CustomResourceDefinition.

func (CRDRenderFn) Render

Render the supplied CompositeResourceDefinition's corresponding CustomResourceDefinition.

type CRDRenderer

type CRDRenderer interface {
	Render(d *v1.CompositeResourceDefinition) (*extv1.CustomResourceDefinition, error)
}

A CRDRenderer renders a CompositeResourceDefinition's corresponding CustomResourceDefinition.

type ControllerEngine

type ControllerEngine interface {
	Start(name string, o ...engine.ControllerOption) error
	Stop(ctx context.Context, name string) error
	IsRunning(name string) bool
	GetWatches(name string) ([]engine.WatchID, error)
	StartWatches(name string, ws ...engine.Watch) error
	StopWatches(ctx context.Context, name string, ws ...engine.WatchID) (int, error)
	GetClient() client.Client
	GetFieldIndexer() client.FieldIndexer
}

A ControllerEngine can start and stop Kubernetes controllers on demand.

type NopEngine added in v1.17.0

type NopEngine struct{}

A NopEngine does nothing.

func (*NopEngine) GetClient added in v1.17.0

func (e *NopEngine) GetClient() client.Client

GetClient returns a nil client.

func (*NopEngine) GetFieldIndexer added in v1.17.0

func (e *NopEngine) GetFieldIndexer() client.FieldIndexer

GetFieldIndexer returns a nil field indexer.

func (*NopEngine) GetWatches added in v1.17.0

func (e *NopEngine) GetWatches(_ string) ([]engine.WatchID, error)

GetWatches does nothing.

func (*NopEngine) IsRunning added in v1.17.0

func (e *NopEngine) IsRunning(_ string) bool

IsRunning always returns true.

func (*NopEngine) Start added in v1.17.0

func (e *NopEngine) Start(_ string, _ ...engine.ControllerOption) error

Start does nothing.

func (*NopEngine) StartWatches added in v1.17.0

func (e *NopEngine) StartWatches(_ string, _ ...engine.Watch) error

StartWatches does nothing.

func (*NopEngine) Stop added in v1.17.0

func (e *NopEngine) Stop(_ context.Context, _ string) error

Stop does nothing.

func (*NopEngine) StopWatches added in v1.17.0

func (e *NopEngine) StopWatches(_ context.Context, _ string, _ ...engine.WatchID) (int, error)

StopWatches does nothing.

type Reconciler

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

A Reconciler reconciles CompositeResourceDefinitions.

func NewReconciler

func NewReconciler(ca resource.ClientApplicator, opts ...ReconcilerOption) *Reconciler

NewReconciler returns a Reconciler of CompositeResourceDefinitions.

func (*Reconciler) CompositeReconcilerOptions added in v1.17.0

func (r *Reconciler) CompositeReconcilerOptions(ctx context.Context, d *v1.CompositeResourceDefinition) []composite.ReconcilerOption

CompositeReconcilerOptions builds the options for a composite resource reconciler. The options vary based on the supplied feature flags.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

Reconcile a CompositeResourceDefinition by defining a new kind of composite resource and starting a controller to reconcile it.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

ReconcilerOption is used to configure the Reconciler.

func WithCRDRenderer

func WithCRDRenderer(c CRDRenderer) ReconcilerOption

WithCRDRenderer specifies how the Reconciler should render an CompositeResourceDefinition's corresponding CustomResourceDefinition.

func WithControllerEngine

func WithControllerEngine(c ControllerEngine) ReconcilerOption

WithControllerEngine specifies how the Reconciler should manage the lifecycles of composite controllers.

func WithFinalizer

func WithFinalizer(f resource.Finalizer) ReconcilerOption

WithFinalizer specifies how the Reconciler should finalize CompositeResourceDefinitions.

func WithLogger

func WithLogger(log logging.Logger) ReconcilerOption

WithLogger specifies how the Reconciler should log messages.

func WithOptions added in v1.6.0

WithOptions lets the Reconciler know which options to pass to new composite resource controllers.

func WithRecorder

func WithRecorder(er event.Recorder) ReconcilerOption

WithRecorder specifies how the Reconciler should record Kubernetes events.

Jump to

Keyboard shortcuts

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