resource

package
v0.0.0-...-e4d61ee Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReasonBinding = "Managed claim is waiting for managed resource to become bindable"
)

Reasons a resource claim is or is not ready.

Variables

This section is empty.

Functions

func Binding

func Binding() v1alpha1.Condition

Binding returns a condition that indicates the resource claim is currently waiting for its managed resource to become bindable.

func ConnectionSecretFor

func ConnectionSecretFor(o ConnectionSecretOwner, kind schema.GroupVersionKind) *corev1.Secret

ConnectionSecretFor the supplied ConnectionSecretOwner, assumed to be of the supplied kind.

func Ignore

func Ignore(is ErrorIs, err error) error

Ignore any errors that satisfy the supplied ErrorIs function by returning nil. Errors that do not satisfy the suppled function are returned unmodified.

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound returns the supplied error, or nil if the error indicates a Kubernetes resource was not found.

func IsBindable

func IsBindable(b Bindable) bool

IsBindable returns true if the supplied Bindable is ready for binding to another Bindable, such as a resource claim or managed resource.

func IsBound

func IsBound(b Bindable) bool

IsBound returns true if the supplied Bindable is bound to another Bindable, such as a resource claim or managed resource.

func MustCreateObject

func MustCreateObject(kind schema.GroupVersionKind, oc runtime.ObjectCreater) runtime.Object

MustCreateObject returns a new Object of the supplied kind. It panics if the kind is unknown to the supplied ObjectCreator.

func MustGetKind

MustGetKind returns the GroupVersionKind of the supplied object. It panics if the object is unknown to the supplied ObjectTyper, the object is unversioned, or the object does not have exactly one registered kind.

func NewPredicates

func NewPredicates(fn PredicateFn) predicate.Funcs

NewPredicates returns a set of Funcs that are all satisfied by the supplied PredicateFn. The PredicateFn is run against the new object during updates.

func ResolveClassClaimValues

func ResolveClassClaimValues(classValue, claimValue string) (string, error)

ResolveClassClaimValues validates the supplied claim value against the supplied resource class value. If both are non-zero they must match.

func SetBindable

func SetBindable(b Bindable)

SetBindable indicates that the supplied Bindable is ready for binding to another Bindable, such as a resource claim or managed resource.

Types

type APIClaimFinalizerRemover

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

An APIClaimFinalizerRemover finalizes the deletion of a resource claim by removing its finalizer and updating it in the API server.

func NewAPIClaimFinalizerRemover

func NewAPIClaimFinalizerRemover(c client.Client) *APIClaimFinalizerRemover

NewAPIClaimFinalizerRemover returns a new APIClaimFinalizerRemover.

func (*APIClaimFinalizerRemover) Finalize

func (a *APIClaimFinalizerRemover) Finalize(ctx context.Context, cm Claim) error

Finalize the supplied resource claim.

type APIManagedBinder

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

An APIManagedBinder binds resources to claims by updating them in a Kubernetes API server. Note that APIManagedBinder does not support objects using the status subresource; such objects should use APIManagedStatusBinder.

func NewAPIManagedBinder

func NewAPIManagedBinder(c client.Client) *APIManagedBinder

NewAPIManagedBinder returns a new APIManagedBinder.

func (*APIManagedBinder) Bind

func (a *APIManagedBinder) Bind(ctx context.Context, cm Claim, mg Managed) error

Bind the supplied resource to the supplied claim.

type APIManagedConnectionPropagator

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

An APIManagedConnectionPropagator propagates connection details by reading them from and writing them to a Kubernetes API server.

func NewAPIManagedConnectionPropagator

func NewAPIManagedConnectionPropagator(c client.Client, t runtime.ObjectTyper) *APIManagedConnectionPropagator

NewAPIManagedConnectionPropagator returns a new APIManagedConnectionPropagator.

func (*APIManagedConnectionPropagator) PropagateConnection

func (a *APIManagedConnectionPropagator) PropagateConnection(ctx context.Context, cm Claim, mg Managed) error

PropagateConnection details from the supplied resource to the supplied claim.

type APIManagedCreator

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

An APIManagedCreator creates resources by submitting them to a Kubernetes API server.

func NewAPIManagedCreator

func NewAPIManagedCreator(c client.Client, t runtime.ObjectTyper) *APIManagedCreator

NewAPIManagedCreator returns a new APIManagedCreator.

func (*APIManagedCreator) Create

func (a *APIManagedCreator) Create(ctx context.Context, cm Claim, cs Class, mg Managed) error

Create the supplied resource using the supplied class and claim.

type APIManagedFinalizerAdder

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

An APIManagedFinalizerAdder establishes ownership of a managed resource by adding a finalizer and updating it in the API server.

func NewAPIManagedFinalizerAdder

func NewAPIManagedFinalizerAdder(c client.Client) *APIManagedFinalizerAdder

NewAPIManagedFinalizerAdder returns a new APIManagedFinalizerAdder.

func (*APIManagedFinalizerAdder) Establish

func (a *APIManagedFinalizerAdder) Establish(ctx context.Context, mg Managed) error

Establish ownership of the supplied Managed resource.

type APIManagedFinalizerRemover

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

An APIManagedFinalizerRemover finalizes the deletion of a Managed resource by removing its finalizer and updating it in the API server.

func NewAPIManagedFinalizerRemover

func NewAPIManagedFinalizerRemover(c client.Client) *APIManagedFinalizerRemover

NewAPIManagedFinalizerRemover returns a new APIManagedFinalizerRemover.

func (*APIManagedFinalizerRemover) Finalize

Finalize the deletion of the supplied Managed resource.

type APIManagedStatusBinder

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

An APIManagedStatusBinder binds resources to claims by updating them in a Kubernetes API server. Note that APIManagedStatusBinder does not support objects that do not use the status subresource; such objects should use APIManagedBinder.

func NewAPIManagedStatusBinder

func NewAPIManagedStatusBinder(c client.Client) *APIManagedStatusBinder

NewAPIManagedStatusBinder returns a new APIManagedStatusBinder.

func (*APIManagedStatusBinder) Bind

Bind the supplied resource to the supplied claim.

type APIManagedStatusUnbinder

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

An APIManagedStatusUnbinder finalizes the deletion of a managed resource by unbinding it, then updating it and its status in the API server.

func NewAPIManagedStatusUnbinder

func NewAPIManagedStatusUnbinder(c client.Client) *APIManagedStatusUnbinder

NewAPIManagedStatusUnbinder returns a new APIStatusManagedFinalizer.

func (*APIManagedStatusUnbinder) Finalize

func (a *APIManagedStatusUnbinder) Finalize(ctx context.Context, mg Managed) error

Finalize the supplied resource claim.

type APIManagedUnbinder

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

An APIManagedUnbinder finalizes the deletion of a managed resource by unbinding it, then updating it in the API server.

func NewAPIManagedUnbinder

func NewAPIManagedUnbinder(c client.Client) *APIManagedUnbinder

NewAPIManagedUnbinder returns a new APIManagedUnbinder.

func (*APIManagedUnbinder) Finalize

func (a *APIManagedUnbinder) Finalize(ctx context.Context, mg Managed) error

Finalize the supplied managed rersource.

type APISecretPublisher

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

An APISecretPublisher publishes ConnectionDetails by submitting a Secret to a Kubernetes API server.

func NewAPISecretPublisher

func NewAPISecretPublisher(c client.Client, ot runtime.ObjectTyper) *APISecretPublisher

NewAPISecretPublisher returns a new APISecretPublisher.

func (*APISecretPublisher) PublishConnection

func (a *APISecretPublisher) PublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error

PublishConnection publishes the supplied ConnectionDetails to a Secret in the same namespace as the supplied Managed resource. Applying is a no-op if the secret already exists with the supplied ConnectionDetails.

func (*APISecretPublisher) UnpublishConnection

func (a *APISecretPublisher) UnpublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error

UnpublishConnection is no-op since PublishConnection only creates resources that will be garbage collected by Kubernetes when the managed resource is deleted.

type Bindable

type Bindable interface {
	SetBindingPhase(p v1alpha1.BindingPhase)
	GetBindingPhase() v1alpha1.BindingPhase
}

A Bindable resource may be bound to another resource. Resources are bindable when they available for use.

type Claim

A Claim is a Kubernetes object representing an abstract resource claim (e.g. an SQL database) that may be bound to a concrete managed resource (e.g. a CloudSQL instance).

type ClaimFinalizer

type ClaimFinalizer interface {
	Finalize(ctx context.Context, cm Claim) error
}

A ClaimFinalizer finalizes the deletion of a resource claim.

type ClaimFinalizerFn

type ClaimFinalizerFn func(ctx context.Context, cm Claim) error

A ClaimFinalizerFn is a function that sastisfies the ClaimFinalizer interface.

func (ClaimFinalizerFn) Finalize

func (fn ClaimFinalizerFn) Finalize(ctx context.Context, cm Claim) error

Finalize the supplied managed resource.

type ClaimKind

type ClaimKind schema.GroupVersionKind

A ClaimKind contains the type metadata for a kind of resource claim.

type ClaimReconciler

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

A ClaimReconciler reconciles resource claims by creating exactly one kind of concrete managed resource. Each resource claim kind should create an instance of this controller for each managed 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 claims and any managed resources they control.

func NewClaimReconciler

func NewClaimReconciler(m manager.Manager, of ClaimKind, using ClassKind, with ManagedKind, o ...ClaimReconcilerOption) *ClaimReconciler

NewClaimReconciler returns a ClaimReconciler that reconciles resource claims of the supplied ClaimKind with resources of the supplied ManagedKind. It panics if asked to reconcile a claim or resource kind that is not registered with the supplied manager's runtime.Scheme. The returned ClaimReconciler will apply only the ObjectMetaConfigurator by default; most callers should supply one or more ManagedConfigurators to configure their managed resources.

func (*ClaimReconciler) Reconcile

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

Reconcile a resource claim with a concrete managed resource.

type ClaimReconcilerOption

type ClaimReconcilerOption func(*ClaimReconciler)

A ClaimReconcilerOption configures a Reconciler.

func WithClaimFinalizer

func WithClaimFinalizer(f ClaimFinalizer) ClaimReconcilerOption

WithClaimFinalizer specifies which ClaimFinalizer should be used to finalize claims when they are deleted.

func WithManagedBinder

func WithManagedBinder(b ManagedBinder) ClaimReconcilerOption

WithManagedBinder specifies which ManagedBinder should be used to bind resources to their claim.

func WithManagedConfigurators

func WithManagedConfigurators(c ...ManagedConfigurator) ClaimReconcilerOption

WithManagedConfigurators specifies which configurators should be used to configure each managed resource. Configurators will be applied in the order they are specified.

func WithManagedConnectionPropagator

func WithManagedConnectionPropagator(p ManagedConnectionPropagator) ClaimReconcilerOption

WithManagedConnectionPropagator specifies which ManagedConnectionPropagator should be used to propagate resource connection details to their claim.

func WithManagedCreator

func WithManagedCreator(c ManagedCreator) ClaimReconcilerOption

WithManagedCreator specifies which ManagedCreator should be used to create managed resources.

func WithManagedFinalizer

func WithManagedFinalizer(f ManagedFinalizer) ClaimReconcilerOption

WithManagedFinalizer specifies which ManagedFinalizer should be used to finalize managed resources when their claims are deleted.

type ClaimReferencer

type ClaimReferencer interface {
	SetClaimReference(r *corev1.ObjectReference)
	GetClaimReference() *corev1.ObjectReference
}

A ClaimReferencer may reference a resource claim.

type Class

type Class interface {
	runtime.Object
	metav1.Object

	Reclaimer
}

A Class is a Kubernetes object representing configuration specifications for a manged resource.

type ClassKind

type ClassKind schema.GroupVersionKind

A ClassKind contains the type metadata for a kind of resource class.

type ClassReferencer

type ClassReferencer interface {
	SetClassReference(r *corev1.ObjectReference)
	GetClassReference() *corev1.ObjectReference
}

A ClassReferencer may reference a resource class.

type ConditionSetter

type ConditionSetter interface {
	SetConditions(c ...v1alpha1.Condition)
}

A ConditionSetter may have conditions set. Conditions are informational, and typically indicate the status of both a resource and its reconciliation process.

type ConfiguratorChain

type ConfiguratorChain []ManagedConfigurator

A ConfiguratorChain chains multiple configurators.

func (ConfiguratorChain) Configure

func (cc ConfiguratorChain) Configure(ctx context.Context, cm Claim, cs Class, mg Managed) error

Configure calls each ManagedConfigurator serially. It returns the first error it encounters, if any.

type ConnectionDetails

type ConnectionDetails map[string][]byte

ConnectionDetails created or updated during an operation on an external resource, for example usernames, passwords, endpoints, ports, etc.

type ConnectionSecretOwner

type ConnectionSecretOwner interface {
	metav1.Object
	ConnectionSecretWriterTo
}

A ConnectionSecretOwner may create and manage a connection secret.

type ConnectionSecretWriterTo

type ConnectionSecretWriterTo interface {
	SetWriteConnectionSecretToReference(r corev1.LocalObjectReference)
	GetWriteConnectionSecretToReference() corev1.LocalObjectReference
}

A ConnectionSecretWriterTo may write a connection secret.

type DefaultClassReconciler

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

DefaultClassReconciler reconciles resource claims to the default resource class for their given kind according to existing policies. Predicates ensure that only claims with no resource class reference are reconciled.

func NewDefaultClassReconciler

func NewDefaultClassReconciler(m manager.Manager, of ClaimKind, by PolicyKind, o ...DefaultClassReconcilerOption) *DefaultClassReconciler

NewDefaultClassReconciler creates a new DefaultReconciler for the claim kind.

func (*DefaultClassReconciler) Reconcile

Reconcile reconciles a claim to the default class reference for its kind.

type DefaultClassReconcilerOption

type DefaultClassReconcilerOption func(*DefaultClassReconciler)

A DefaultClassReconcilerOption configures a DefaultClassReconciler.

func WithObjectConverter

WithObjectConverter specifies how the DefaultClassReconciler should convert an *UnstructuredList into a concrete list type.

type DefaultClassReferencer

type DefaultClassReferencer interface {
	SetDefaultClassReference(r *corev1.ObjectReference)
	GetDefaultClassReference() *corev1.ObjectReference
}

A DefaultClassReferencer may reference a default resource class.

type EnqueueRequestForClaim

type EnqueueRequestForClaim struct{}

EnqueueRequestForClaim enqueues a reconcile.Request for the NamespacedName of a ClaimReferencer's ClaimReference.

func (*EnqueueRequestForClaim) Create

Create adds a NamespacedName for the supplied CreateEvent if its Object is a ClaimReferencer.

func (*EnqueueRequestForClaim) Delete

Delete adds a NamespacedName for the supplied DeleteEvent if its Object is a ClaimReferencer.

func (*EnqueueRequestForClaim) Generic

Generic adds a NamespacedName for the supplied GenericEvent if its Object is a ClaimReferencer.

func (*EnqueueRequestForClaim) Update

Update adds a NamespacedName for the supplied UpdateEvent if its Objects are ClaimReferencers.

type ErrorIs

type ErrorIs func(err error) bool

An ErrorIs function returns true if an error satisfies a particular condition.

type ExternalClient

type ExternalClient interface {
	// Observe the external resource the supplied Managed resource represents,
	// if any. Observe implementations must not modify the external resource,
	// but may update the supplied Managed resource to reflect the state of the
	// external resource.
	Observe(ctx context.Context, mg Managed) (ExternalObservation, error)

	// Create an external resource per the specifications of the supplied
	// Managed resource.
	Create(ctx context.Context, mg Managed) (ExternalCreation, error)

	// Update the external resource represented by the supplied Managed
	// resource, if necessary. Update implementations must handle the case in
	// which no update is necessary.
	Update(ctx context.Context, mg Managed) (ExternalUpdate, error)

	// Delete the external resource upon deletion of its associated Managed
	// resource.
	Delete(ctx context.Context, mg Managed) error
}

An ExternalClient manages the lifecycle of an external resource. None of the calls here should be blocking. All of the calls should be idempotent. For example, Create call should not return AlreadyExists error if it's called again with the same parameters or Delete call should not return error if there is an ongoing deletion or resource does not exist.

type ExternalClientFns

type ExternalClientFns struct {
	ObserveFn func(ctx context.Context, mg Managed) (ExternalObservation, error)
	CreateFn  func(ctx context.Context, mg Managed) (ExternalCreation, error)
	UpdateFn  func(ctx context.Context, mg Managed) (ExternalUpdate, error)
	DeleteFn  func(ctx context.Context, mg Managed) error
}

ExternalClientFns is the pluggable struct to produce an ExternalClient from given functions.

func (ExternalClientFns) Create

Create calls plugged CreateFn function.

func (ExternalClientFns) Delete

func (e ExternalClientFns) Delete(ctx context.Context, mg Managed) error

Delete calls plugged DeleteFn function.

func (ExternalClientFns) Observe

Observe calls plugged ObserveFn function.

func (ExternalClientFns) Update

Update calls plugged UpdateFn function.

type ExternalConnecter

type ExternalConnecter interface {
	Connect(ctx context.Context, mg Managed) (ExternalClient, error)
}

An ExternalConnecter produces a new ExternalClient given the supplied Managed resource.

type ExternalConnectorFn

type ExternalConnectorFn func(ctx context.Context, mg Managed) (ExternalClient, error)

ExternalConnectorFn is the pluggable struct to produce an ExternalConnector from given functions.

func (ExternalConnectorFn) Connect

Connect calls plugged ExternalConnectorFn function.

type ExternalCreation

type ExternalCreation struct {
	ConnectionDetails ConnectionDetails
}

An ExternalCreation is the result of the creation of an external resource.

type ExternalObservation

type ExternalObservation struct {
	ResourceExists    bool
	ConnectionDetails ConnectionDetails
}

An ExternalObservation is the result of an observation of an external resource.

type ExternalUpdate

type ExternalUpdate struct {
	ConnectionDetails ConnectionDetails
}

An ExternalUpdate is the result of an update to an external resource.

type Managed

A Managed is a Kubernetes object representing a concrete managed resource (e.g. a CloudSQL instance).

type ManagedBinder

type ManagedBinder interface {
	Bind(ctx context.Context, cm Claim, mg Managed) error
}

A ManagedBinder binds a resource claim to a managed resource.

type ManagedBinderFn

type ManagedBinderFn func(ctx context.Context, cm Claim, mg Managed) error

A ManagedBinderFn is a function that sastisfies the ManagedBinder interface.

func (ManagedBinderFn) Bind

func (fn ManagedBinderFn) Bind(ctx context.Context, cm Claim, mg Managed) error

Bind the supplied resource claim to the supplied managed resource.

type ManagedConfigurator

type ManagedConfigurator interface {
	Configure(ctx context.Context, cm Claim, cs Class, mg Managed) error
}

A ManagedConfigurator configures a resource, typically by converting it to a known type and populating its spec.

type ManagedConfiguratorFn

type ManagedConfiguratorFn func(ctx context.Context, cm Claim, cs Class, mg Managed) error

A ManagedConfiguratorFn is a function that sastisfies the ManagedConfigurator interface.

func (ManagedConfiguratorFn) Configure

func (fn ManagedConfiguratorFn) Configure(ctx context.Context, cm Claim, cs Class, mg Managed) error

Configure the supplied resource using the supplied claim and class.

type ManagedConnectionPropagator

type ManagedConnectionPropagator interface {
	PropagateConnection(ctx context.Context, cm Claim, mg Managed) error
}

A ManagedConnectionPropagator is responsible for propagating information required to connect to a managed resource (for example the connection secret) from the managed resource to its resource claim.

type ManagedConnectionPropagatorFn

type ManagedConnectionPropagatorFn func(ctx context.Context, cm Claim, mg Managed) error

A ManagedConnectionPropagatorFn is a function that sastisfies the ManagedConnectionPropagator interface.

func (ManagedConnectionPropagatorFn) PropagateConnection

func (fn ManagedConnectionPropagatorFn) PropagateConnection(ctx context.Context, cm Claim, mg Managed) error

PropagateConnection information from the supplied managed resource to the supplied resource claim.

type ManagedConnectionPublisher

type ManagedConnectionPublisher interface {
	PublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error
	UnpublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error
}

A ManagedConnectionPublisher manages the supplied ConnectionDetails for the supplied Managed resource. ManagedPublishers must handle the case in which the supplied ConnectionDetails are empty.

type ManagedConnectionPublisherFns

type ManagedConnectionPublisherFns struct {
	PublishConnectionFn   func(ctx context.Context, mg Managed, c ConnectionDetails) error
	UnpublishConnectionFn func(ctx context.Context, mg Managed, c ConnectionDetails) error
}

ManagedConnectionPublisherFns is the pluggable struct to produce objects with ManagedConnectionPublisher interface.

func (ManagedConnectionPublisherFns) PublishConnection

PublishConnection calls plugged PublishConnectionFn.

func (ManagedConnectionPublisherFns) UnpublishConnection

func (fn ManagedConnectionPublisherFns) UnpublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error

UnpublishConnection calls plugged UnpublishConnectionFn.

type ManagedCreator

type ManagedCreator interface {
	Create(ctx context.Context, cm Claim, cs Class, mg Managed) error
}

A ManagedCreator creates a resource, typically by submitting it to an API server. ManagedCreators must not modify the supplied resource class, but are responsible for final modifications to the claim and resource, for example ensuring resource, class, claim, and owner references are set.

type ManagedCreatorFn

type ManagedCreatorFn func(ctx context.Context, cm Claim, cs Class, mg Managed) error

A ManagedCreatorFn is a function that sastisfies the ManagedCreator interface.

func (ManagedCreatorFn) Create

func (fn ManagedCreatorFn) Create(ctx context.Context, cm Claim, cs Class, mg Managed) error

Create the supplied resource.

type ManagedEstablisher

type ManagedEstablisher interface {
	Establish(ctx context.Context, mg Managed) error
}

A ManagedEstablisher establishes ownership of the supplied Managed resource. This typically involves adding a finalizer to the object metadata.

type ManagedEstablisherFn

type ManagedEstablisherFn func(ctx context.Context, mg Managed) error

ManagedEstablisherFn is the pluggable struct to produce objects with ManagedEstablisher interface.

func (ManagedEstablisherFn) Establish

func (m ManagedEstablisherFn) Establish(ctx context.Context, mg Managed) error

Establish calls ManagedEstablisherFn function.

type ManagedFinalizer

type ManagedFinalizer interface {
	Finalize(ctx context.Context, cm Managed) error
}

A ManagedFinalizer finalizes the deletion of a resource claim.

type ManagedFinalizerFn

type ManagedFinalizerFn func(ctx context.Context, cm Managed) error

A ManagedFinalizerFn is a function that sastisfies the ManagedFinalizer interface.

func (ManagedFinalizerFn) Finalize

func (fn ManagedFinalizerFn) Finalize(ctx context.Context, cm Managed) error

Finalize the supplied managed resource.

type ManagedKind

type ManagedKind schema.GroupVersionKind

A ManagedKind contains the type metadata for a kind of managed resource.

type ManagedReconciler

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

A ManagedReconciler reconciles managed resources by creating and managing the lifecycle of an external resource, i.e. a resource in an external system such as a cloud provider API. Each controller must watch the managed resource kind for which it is responsible.

func NewManagedReconciler

func NewManagedReconciler(m manager.Manager, of ManagedKind, o ...ManagedReconcilerOption) *ManagedReconciler

NewManagedReconciler returns a ManagedReconciler that reconciles managed resources of the supplied ManagedKind with resources in an external system such as a cloud provider API. It panics if asked to reconcile a managed resource kind that is not registered with the supplied manager's runtime.Scheme. The returned ManagedReconciler reconciles with a dummy, no-op 'external system' by default; callers should supply an ExternalConnector that returns an ExternalClient capable of managing resources in a real system.

func (*ManagedReconciler) Reconcile

Reconcile a managed resource with an external resource.

type ManagedReconcilerOption

type ManagedReconcilerOption func(*ManagedReconciler)

A ManagedReconcilerOption configures a ManagedReconciler.

func WithExternalConnecter

func WithExternalConnecter(c ExternalConnecter) ManagedReconcilerOption

WithExternalConnecter specifies how the Reconciler should connect to the API used to sync and delete external resources.

func WithLongWait

func WithLongWait(after time.Duration) ManagedReconcilerOption

WithLongWait specifies how long the ManagedReconciler should wait before queueing a new reconciliation in 'long wait' scenarios. The Reconciler requeues after a long wait when it is not actively waiting for an external operation, but wishes to check whether an existing external resource needs to be synced to its Crossplane Managed resource.

func WithManagedConnectionPublishers

func WithManagedConnectionPublishers(p ...ManagedConnectionPublisher) ManagedReconcilerOption

WithManagedConnectionPublishers specifies how the Reconciler should publish its connection details such as credentials and endpoints.

func WithShortWait

func WithShortWait(after time.Duration) ManagedReconcilerOption

WithShortWait specifies how long the ManagedReconciler should wait before queueing a new reconciliation in 'short wait' scenarios. The Reconciler requeues after a short wait when it knows it is waiting for an external operation to complete, or when it encounters a potentially temporary error.

type ManagedResourceReferencer

type ManagedResourceReferencer interface {
	SetResourceReference(r *corev1.ObjectReference)
	GetResourceReference() *corev1.ObjectReference
}

A ManagedResourceReferencer may reference a concrete managed resource.

type NopClient

type NopClient struct{}

A NopClient does nothing.

func (*NopClient) Create

func (c *NopClient) Create(ctx context.Context, mg Managed) (ExternalCreation, error)

Create does nothing. It returns an empty ExternalCreation and no error.

func (*NopClient) Delete

func (c *NopClient) Delete(ctx context.Context, mg Managed) error

Delete does nothing. It never returns an error.

func (*NopClient) Observe

func (c *NopClient) Observe(ctx context.Context, mg Managed) (ExternalObservation, error)

Observe does nothing. It returns an empty ExternalObservation and no error.

func (*NopClient) Update

func (c *NopClient) Update(ctx context.Context, mg Managed) (ExternalUpdate, error)

Update does nothing. It returns an empty ExternalUpdate and no error.

type NopConnecter

type NopConnecter struct{}

A NopConnecter does nothing.

func (*NopConnecter) Connect

Connect returns a NopClient. It never returns an error.

type ObjectMetaConfigurator

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

An ObjectMetaConfigurator sets standard object metadata for a dynamically provisioned resource, deriving it from a class and claim.

func NewObjectMetaConfigurator

func NewObjectMetaConfigurator(t runtime.ObjectTyper) *ObjectMetaConfigurator

NewObjectMetaConfigurator returns a new ObjectMetaConfigurator.

func (*ObjectMetaConfigurator) Configure

func (c *ObjectMetaConfigurator) Configure(_ context.Context, cm Claim, cs Class, mg Managed) error

Configure the supplied Managed resource's object metadata.

type Policy

type Policy interface {
	runtime.Object
	metav1.Object

	DefaultClassReferencer
}

A Policy is a Kubernetes object representing a default behavior for a given claim kind.

type PolicyKind

type PolicyKind struct {
	Singular schema.GroupVersionKind
	Plural   schema.GroupVersionKind
}

A PolicyKind contains the type metadata for a kind of policy.

type PolicyList

type PolicyList interface {
	runtime.Object
	metav1.ListInterface
}

A PolicyList is a Kubernetes object representing representing a list of policies.

type PredicateFn

type PredicateFn func(obj runtime.Object) bool

A PredicateFn returns true if the supplied object should be reconciled.

func HasClassReferenceKind

func HasClassReferenceKind(k ClassKind) PredicateFn

HasClassReferenceKind accepts ResourceClaims that reference the correct kind of resourceclass

func NoClassReference

func NoClassReference() PredicateFn

NoClassReference accepts ResourceClaims that do not reference a specific ResourceClass

func NoManagedResourceReference

func NoManagedResourceReference() PredicateFn

NoManagedResourceReference accepts ResourceClaims that do not reference a specific Managed Resource

type PublisherChain

type PublisherChain []ManagedConnectionPublisher

A PublisherChain chains multiple ManagedPublishers.

func (PublisherChain) PublishConnection

func (pc PublisherChain) PublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error

PublishConnection calls each ManagedConnectionPublisher.PublishConnection serially. It returns the first error it encounters, if any.

func (PublisherChain) UnpublishConnection

func (pc PublisherChain) UnpublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error

UnpublishConnection calls each ManagedConnectionPublisher.UnpublishConnection serially. It returns the first error it encounters, if any.

type Reclaimer

type Reclaimer interface {
	SetReclaimPolicy(p v1alpha1.ReclaimPolicy)
	GetReclaimPolicy() v1alpha1.ReclaimPolicy
}

A Reclaimer may specify a ReclaimPolicy.

Jump to

Keyboard shortcuts

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