requirement

package
v0.11.2 Latest Latest
Warning

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

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

Documentation

Overview

Package requirement provides a resource requirement reconciler.

Index

Constants

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

func ControllerName(name string) string

ControllerName returns the recommended name for controllers that use this package to reconcile a particular kind of resource requirement.

func RemoveRequirementReference

func RemoveRequirementReference(cp resource.Composite)

RemoveRequirementReference removes the requirement reference from the supplied resource.Composite if it contains a *composite.Unstructured.

func Waiting

func Waiting() v1alpha1.Condition

Waiting returns a condition that indicates the resource requirement is currently waiting for its composite resource to become ready.

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) Bind

Bind the supplied requirement to the supplied composite.

func (*APIBinder) Unbind

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

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.

func (BinderFns) Bind

Bind the supplied Requirement to the supplied Composite resource.

func (BinderFns) Unbind

Unbind the supplied Requirement from the supplied Composite resource.

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

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

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

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.

func (*Reconciler) Reconcile

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

Reconcile a resource requirement with a concrete composite resource.

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.

Jump to

Keyboard shortcuts

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