Documentation ¶
Overview ¶
Package requirement provides a resource requirement reconciler.
Index ¶
- Constants
- func Configure(_ context.Context, rq resource.Requirement, cp resource.Composite) error
- func ControllerName(name string) string
- func RemoveRequirementReference(cp resource.Composite)
- func Waiting() v1alpha1.Condition
- type APIBinder
- type APICompositeCreator
- type Binder
- type BinderFns
- type CompositeConfigurator
- type CompositeConfiguratorFn
- type CompositeCreator
- type CompositeCreatorFn
- type Reconciler
- type ReconcilerOption
- func WithBinder(b Binder) ReconcilerOption
- func WithCompositeCreator(c CompositeCreator) ReconcilerOption
- func WithConnectionPropagator(p resource.ConnectionPropagator) ReconcilerOption
- func WithLogger(l logging.Logger) ReconcilerOption
- func WithRecorder(er event.Recorder) ReconcilerOption
- func WithRequirementFinalizer(f resource.Finalizer) ReconcilerOption
Constants ¶
const (
ReasonWaiting = "Resource requirement is waiting for composite resource to become Ready"
)
Reasons a resource requirement is or is not ready.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
Configure the supplied composite resource. The composite resource name is derived from the supplied requirement, as {namespace}-{name}-{random-string}. The requirement's external name annotation, if any, is propagated to the composite resource.
func ControllerName ¶
ControllerName returns the recommended name for controllers that use this package to reconcile a particular kind of resource requirement.
func RemoveRequirementReference ¶
RemoveRequirementReference removes the requirement reference from the supplied resource.Composite if it contains a *composite.Unstructured.
Types ¶
type APIBinder ¶
type APIBinder struct {
// contains filtered or unexported fields
}
An APIBinder binds requirements to composites by updating them in a Kubernetes API server. Note that APIBinder does not support objects that do not use the status subresource; such objects should use APIBinder.
func NewAPIBinder ¶
func NewAPIBinder(c client.Client, t runtime.ObjectTyper) *APIBinder
NewAPIBinder returns a new APIBinder.
func (*APIBinder) Unbind ¶
func (a *APIBinder) Unbind(ctx context.Context, _ resource.Requirement, cp resource.Composite) error
Unbind the supplied Requirement from the supplied Composite resource by removing the composite resource's requirement reference, and if the composite resource's reclaim policy is "Delete", deleting it.
type APICompositeCreator ¶
type APICompositeCreator struct {
// contains filtered or unexported fields
}
An APICompositeCreator creates resources by submitting them to a Kubernetes API server.
func NewAPICompositeCreator ¶
func NewAPICompositeCreator(c client.Client, t runtime.ObjectTyper) *APICompositeCreator
NewAPICompositeCreator returns a new APICompositeCreator.
func (*APICompositeCreator) Create ¶
func (a *APICompositeCreator) Create(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
Create the supplied composite using the supplied requirement.
type Binder ¶
type Binder interface { // Bind the supplied Requirement to the supplied Composite resource. Bind(ctx context.Context, rq resource.Requirement, cp resource.Composite) error // Unbind the supplied Requirement from the supplied Composite resource. Unbind(ctx context.Context, rq resource.Requirement, cp resource.Composite) error }
A Binder binds a resource requirement to a composite resource.
type BinderFns ¶
type BinderFns struct { BindFn func(ctx context.Context, rq resource.Requirement, cp resource.Composite) error UnbindFn func(ctx context.Context, rq resource.Requirement, cp resource.Composite) error }
BinderFns satisfy the Binder interface.
type CompositeConfigurator ¶
type CompositeConfigurator interface {
Configure(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
}
A CompositeConfigurator configures a resource, typically by converting it to a known type and populating its spec.
type CompositeConfiguratorFn ¶
type CompositeConfiguratorFn func(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
A CompositeConfiguratorFn is a function that satisfies the CompositeConfigurator interface.
func (CompositeConfiguratorFn) Configure ¶
func (fn CompositeConfiguratorFn) Configure(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
Configure the supplied resource using the supplied requirement and class.
type CompositeCreator ¶
type CompositeCreator interface {
Create(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
}
A CompositeCreator creates a resource, typically by submitting it to an API server. CompositeCreators must not modify the supplied resource class, but are responsible for final modifications to the requirement and resource, for example ensuring resource, class, requirement, and owner references are set.
type CompositeCreatorFn ¶
type CompositeCreatorFn func(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
A CompositeCreatorFn is a function that satisfies the CompositeCreator interface.
func (CompositeCreatorFn) Create ¶
func (fn CompositeCreatorFn) Create(ctx context.Context, rq resource.Requirement, cp resource.Composite) error
Create the supplied resource.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
A Reconciler reconciles resource requirements by creating exactly one kind of concrete composite resource. Each resource requirement kind should create an instance of this controller for each composite resource kind they can bind to, using watch predicates to ensure each controller is responsible for exactly one type of resource class provisioner. Each controller must watch its subset of resource requirements and any composite resources they control.
func NewReconciler ¶
func NewReconciler(m manager.Manager, of resource.RequirementKind, with resource.CompositeKind, o ...ReconcilerOption) *Reconciler
NewReconciler returns a Reconciler that reconciles resource requirements of the supplied RequirementKind with resources of the supplied CompositeKind. The returned Reconciler will apply only the ObjectMetaConfigurator by default; most callers should supply one or more CompositeConfigurators to configure their composite resources.
type ReconcilerOption ¶
type ReconcilerOption func(*Reconciler)
A ReconcilerOption configures a Reconciler.
func WithBinder ¶
func WithBinder(b Binder) ReconcilerOption
WithBinder specifies which Binder should be used to bind resources to their requirement.
func WithCompositeCreator ¶
func WithCompositeCreator(c CompositeCreator) ReconcilerOption
WithCompositeCreator specifies which CompositeCreator should be used to create composite resources.
func WithConnectionPropagator ¶
func WithConnectionPropagator(p resource.ConnectionPropagator) ReconcilerOption
WithConnectionPropagator specifies which ConnectionPropagator should be used to propagate resource connection details to their requirement.
func WithLogger ¶
func WithLogger(l logging.Logger) ReconcilerOption
WithLogger specifies how the Reconciler should log messages.
func WithRecorder ¶
func WithRecorder(er event.Recorder) ReconcilerOption
WithRecorder specifies how the Reconciler should record events.
func WithRequirementFinalizer ¶
func WithRequirementFinalizer(f resource.Finalizer) ReconcilerOption
WithRequirementFinalizer specifies which RequirementFinalizer should be used to finalize requirements when they are deleted.