Documentation ¶
Overview ¶
Package definition manages the lifecycle of XR controllers.
Index ¶
- func EnqueueCompositeResources(of resource.CompositeKind, c client.Reader, log logging.Logger) handler.Funcs
- func EnqueueForCompositionRevision(of resource.CompositeKind, c client.Reader, log logging.Logger) handler.Funcs
- func IndexCompositeResourcesRefs(o client.Object) []string
- func IsCompositeResourceCRD() resource.PredicateFn
- func NewClientApplicator(c client.Client) resource.ClientApplicator
- func Setup(mgr ctrl.Manager, o apiextensionscontroller.Options) error
- type CRDRenderFn
- type CRDRenderer
- type ControllerEngine
- type NopEngine
- func (e *NopEngine) GetClient() client.Client
- func (e *NopEngine) GetFieldIndexer() client.FieldIndexer
- func (e *NopEngine) GetWatches(_ string) ([]engine.WatchID, error)
- func (e *NopEngine) IsRunning(_ string) bool
- func (e *NopEngine) Start(_ string, _ ...engine.ControllerOption) error
- func (e *NopEngine) StartWatches(_ string, _ ...engine.Watch) error
- func (e *NopEngine) Stop(_ context.Context, _ string) error
- func (e *NopEngine) StopWatches(_ context.Context, _ string, _ ...engine.WatchID) (int, error)
- type Reconciler
- type ReconcilerOption
- func WithCRDRenderer(c CRDRenderer) ReconcilerOption
- func WithControllerEngine(c ControllerEngine) ReconcilerOption
- func WithFinalizer(f resource.Finalizer) ReconcilerOption
- func WithLogger(log logging.Logger) ReconcilerOption
- func WithOptions(o apiextensionscontroller.Options) ReconcilerOption
- func WithRecorder(er event.Recorder) ReconcilerOption
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
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.
Types ¶
type CRDRenderFn ¶
type CRDRenderFn func(d *v1.CompositeResourceDefinition) (*extv1.CustomResourceDefinition, error)
A CRDRenderFn renders a CompositeResourceDefinition's corresponding CustomResourceDefinition.
func (CRDRenderFn) Render ¶
func (fn CRDRenderFn) Render(d *v1.CompositeResourceDefinition) (*extv1.CustomResourceDefinition, error)
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) 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
GetWatches does nothing.
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
StartWatches 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.
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
func WithOptions(o apiextensionscontroller.Options) ReconcilerOption
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.