Documentation
¶
Overview ¶
Package resource provides types and functions that can be used to build Kubernetes controllers that reconcile Crossplane resources.
Index ¶
- Constants
- func Binding() v1alpha1.Condition
- func ConnectionSecretFor(o ConnectionSecretOwner, kind schema.GroupVersionKind) *corev1.Secret
- func GetKind(obj runtime.Object, ot runtime.ObjectTyper) (schema.GroupVersionKind, error)
- func Ignore(is ErrorIs, err error) error
- func IgnoreNotFound(err error) error
- func IsBindable(b Bindable) bool
- func IsBound(b Bindable) bool
- func IsConditionTrue(c v1alpha1.Condition) bool
- func IsReferencesAccessError(err error) bool
- func LocalConnectionSecretFor(o LocalConnectionSecretOwner, kind schema.GroupVersionKind) *corev1.Secret
- func MustCreateObject(kind schema.GroupVersionKind, oc runtime.ObjectCreater) runtime.Object
- func MustGetKind(obj runtime.Object, ot runtime.ObjectTyper) schema.GroupVersionKind
- func NewPredicates(fn PredicateFn) predicate.Funcs
- func NewSecretPropagatingReconciler(m manager.Manager) reconcile.Reconciler
- func ResolveClassClaimValues(classValue, claimValue string) (string, error)
- func SetBindable(b Bindable)
- type APIClaimFinalizerRemover
- type APIManagedBinder
- type APIManagedConnectionPropagator
- type APIManagedCreator
- type APIManagedFinalizerAdder
- type APIManagedFinalizerRemover
- type APIManagedReferenceResolver
- type APIManagedStatusBinder
- type APIManagedStatusUnbinder
- type APIManagedUnbinder
- type APISecretPublisher
- type AttributeReferencer
- type Bindable
- type CanReference
- type Claim
- type ClaimDefaultingReconciler
- type ClaimDefaultingReconcilerOption
- type ClaimFinalizer
- type ClaimFinalizerFn
- type ClaimKind
- type ClaimReconciler
- type ClaimReconcilerOption
- func WithClaimFinalizer(f ClaimFinalizer) ClaimReconcilerOption
- func WithManagedBinder(b ManagedBinder) ClaimReconcilerOption
- func WithManagedConfigurators(c ...ManagedConfigurator) ClaimReconcilerOption
- func WithManagedConnectionPropagator(p ManagedConnectionPropagator) ClaimReconcilerOption
- func WithManagedCreator(c ManagedCreator) ClaimReconcilerOption
- func WithManagedFinalizer(f ManagedFinalizer) ClaimReconcilerOption
- type ClaimReferencer
- type ClaimSchedulingReconciler
- type ClaimSchedulingReconcilerOption
- type Class
- type ClassKind
- type ClassReferencer
- type ClassSelector
- type Conditioned
- type ConfiguratorChain
- type ConnectionDetails
- type ConnectionSecretOwner
- type ConnectionSecretWriterTo
- type EnqueueRequestForClaim
- func (e *EnqueueRequestForClaim) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForClaim) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForClaim) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForClaim) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type EnqueueRequestForPropagator
- func (e *EnqueueRequestForPropagator) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForPropagator) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForPropagator) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForPropagator) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type ErrorIs
- type ExternalClient
- type ExternalClientFns
- func (e ExternalClientFns) Create(ctx context.Context, mg Managed) (ExternalCreation, error)
- func (e ExternalClientFns) Delete(ctx context.Context, mg Managed) error
- func (e ExternalClientFns) Observe(ctx context.Context, mg Managed) (ExternalObservation, error)
- func (e ExternalClientFns) Update(ctx context.Context, mg Managed) (ExternalUpdate, error)
- type ExternalConnecter
- type ExternalConnectorFn
- type ExternalCreation
- type ExternalObservation
- type ExternalUpdate
- type InitializerChain
- type Jitterer
- type LocalConnectionSecretOwner
- type LocalConnectionSecretWriterTo
- type Managed
- type ManagedBinder
- type ManagedBinderFn
- type ManagedConfigurator
- type ManagedConfiguratorFn
- type ManagedConnectionPropagator
- type ManagedConnectionPropagatorFn
- type ManagedConnectionPublisher
- type ManagedConnectionPublisherFns
- type ManagedCreator
- type ManagedCreatorFn
- type ManagedFinalizer
- type ManagedFinalizerFn
- type ManagedInitializer
- type ManagedInitializerFn
- type ManagedKind
- type ManagedNameAsExternalName
- type ManagedReconciler
- type ManagedReconcilerOption
- func WithExternalConnecter(c ExternalConnecter) ManagedReconcilerOption
- func WithLongWait(after time.Duration) ManagedReconcilerOption
- func WithManagedConnectionPublishers(p ...ManagedConnectionPublisher) ManagedReconcilerOption
- func WithManagedInitializers(i ...ManagedInitializer) ManagedReconcilerOption
- func WithShortWait(after time.Duration) ManagedReconcilerOption
- type ManagedReferenceResolver
- type ManagedReferenceResolverFn
- type ManagedResourceReferencer
- type NopClient
- func (c *NopClient) Create(ctx context.Context, mg Managed) (ExternalCreation, error)
- func (c *NopClient) Delete(ctx context.Context, mg Managed) error
- func (c *NopClient) Observe(ctx context.Context, mg Managed) (ExternalObservation, error)
- func (c *NopClient) Update(ctx context.Context, mg Managed) (ExternalUpdate, error)
- type NopConnecter
- type ObjectMetaConfigurator
- type PredicateFn
- func AllOf(fn ...PredicateFn) PredicateFn
- func AnyOf(fn ...PredicateFn) PredicateFn
- func HasClassReferenceKind(k ClassKind) PredicateFn
- func HasClassSelector() PredicateFn
- func HasManagedResourceReferenceKind(k ManagedKind) PredicateFn
- func HasNoClassReference() PredicateFn
- func HasNoClassSelector() PredicateFn
- func HasNoManagedResourceReference() PredicateFn
- func IsControlledByKind(k schema.GroupVersionKind) PredicateFn
- func IsManagedKind(k ManagedKind, ot runtime.ObjectTyper) PredicateFn
- func IsPropagated() PredicateFn
- func IsPropagator() PredicateFn
- type PublisherChain
- type Reclaimer
- type ReferenceStatus
- type ReferenceStatusType
Constants ¶
const ( AnnotationKeyPropagateToNamespace = "crossplane.io/propagate-to-namespace" AnnotationKeyPropagateToName = "crossplane.io/propagate-to-name" AnnotationKeyPropagateToUID = "crossplane.io/propagate-to-uid" )
Supported resources with all of these annotations will be fully or partially propagated to the named resource of the same kind, assuming it exists and consents to propagation.
const ( AnnotationKeyPropagateFromNamespace = "crossplane.io/propagate-from-namespace" AnnotationKeyPropagateFromName = "crossplane.io/propagate-from-name" AnnotationKeyPropagateFromUID = "crossplane.io/propagate-from-uid" )
Supported resources with all of these annotations consent to be fully or partially propagated from the named resource of the same kind.
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 ¶
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 creates a connection for the supplied ConnectionSecretOwner, assumed to be of the supplied kind. The secret is written to 'default' namespace if the ConnectionSecretOwner does not specify a namespace.
func GetKind ¶
func GetKind(obj runtime.Object, ot runtime.ObjectTyper) (schema.GroupVersionKind, error)
GetKind returns the GroupVersionKind of the supplied object. It return an error if the object is unknown to the supplied ObjectTyper, the object is unversioned, or the object does not have exactly one registered kind.
func Ignore ¶
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 ¶
IgnoreNotFound returns the supplied error, or nil if the error indicates a Kubernetes resource was not found.
func IsBindable ¶
IsBindable returns true if the supplied Bindable is ready for binding to another Bindable, such as a resource claim or managed resource.
func IsBound ¶
IsBound returns true if the supplied Bindable is bound to another Bindable, such as a resource claim or managed resource.
func IsConditionTrue ¶
IsConditionTrue returns if condition status is true
func IsReferencesAccessError ¶
IsReferencesAccessError returns true if the given error indicates that some of the `AttributeReferencer` fields are referring to objects that are not accessible, either they are not ready or they do not yet exist
func LocalConnectionSecretFor ¶
func LocalConnectionSecretFor(o LocalConnectionSecretOwner, kind schema.GroupVersionKind) *corev1.Secret
LocalConnectionSecretFor creates a connection secret in the namespace of the supplied LocalConnectionSecretOwner, assumed to be of the supplied kind.
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 ¶
func MustGetKind(obj runtime.Object, ot runtime.ObjectTyper) schema.GroupVersionKind
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 NewSecretPropagatingReconciler ¶
func NewSecretPropagatingReconciler(m manager.Manager) reconcile.Reconciler
NewSecretPropagatingReconciler returns a Reconciler that reconciles secrets by propagating their data to another secret. Both secrets must consent to this process by including propagation annotations. The Reconciler assumes it has a watch on both propagating (from) and propagated (to) secrets.
func ResolveClassClaimValues ¶
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.
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, t runtime.ObjectTyper) *APIManagedBinder
NewAPIManagedBinder returns a new APIManagedBinder.
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.
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) Initialize ¶
func (a *APIManagedFinalizerAdder) Initialize(ctx context.Context, mg Managed) error
Initialize 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.
type APIManagedReferenceResolver ¶
type APIManagedReferenceResolver struct {
// contains filtered or unexported fields
}
APIManagedReferenceResolver resolves implements ManagedReferenceResolver interface
func NewAPIManagedReferenceResolver ¶
func NewAPIManagedReferenceResolver(c client.Client) *APIManagedReferenceResolver
NewAPIManagedReferenceResolver returns a new APIManagedReferenceResolver
func (*APIManagedReferenceResolver) ResolveReferences ¶
func (r *APIManagedReferenceResolver) ResolveReferences(ctx context.Context, res CanReference) (err error)
ResolveReferences resolves references made to other managed resources
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, t runtime.ObjectTyper) *APIManagedStatusBinder
NewAPIManagedStatusBinder returns a new APIManagedStatusBinder.
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.
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.
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 AttributeReferencer ¶
type AttributeReferencer interface {
// GetStatus looks up the referenced objects in K8S api and returns a list
// of ReferenceStatus
GetStatus(context.Context, CanReference, client.Reader) ([]ReferenceStatus, error)
// Build retrieves referenced resource, as well as other non-managed
// resources (like a `Provider`), and builds the referenced attribute
Build(context.Context, CanReference, client.Reader) (string, error)
// Assign accepts a managed resource object, and assigns the given value to the
// corresponding property
Assign(CanReference, string) error
}
AttributeReferencer is an interface for referencing and resolving cross-resource attribute references. See https://github.com/crossplaneio/crossplane/blob/master/design/one-pager-cross-resource-referencing.md for more information
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 CanReference ¶
CanReference is a type that is used as ReferenceResolver input
type Claim ¶
type Claim interface {
runtime.Object
metav1.Object
ClassSelector
ClassReferencer
ManagedResourceReferencer
LocalConnectionSecretWriterTo
Conditioned
Bindable
}
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 ClaimDefaultingReconciler ¶
type ClaimDefaultingReconciler struct {
// contains filtered or unexported fields
}
A ClaimDefaultingReconciler reconciles resource claims by setting their class reference to the resource class annotated as the default. If multiple classes are annotated as the default one of the annotated classes will be set, but which one is undefined.
func NewClaimDefaultingReconciler ¶
func NewClaimDefaultingReconciler(m manager.Manager, of ClaimKind, to ClassKind, o ...ClaimDefaultingReconcilerOption) *ClaimDefaultingReconciler
NewClaimDefaultingReconciler returns a ClaimDefaultingReconciler that sets the class reference of a resource claim to the resource class annotated as the default.
type ClaimDefaultingReconcilerOption ¶
type ClaimDefaultingReconcilerOption func(*ClaimDefaultingReconciler)
A ClaimDefaultingReconcilerOption configures a ClaimDefaultingReconciler.
func WithDefaultingJitterer ¶
func WithDefaultingJitterer(j Jitterer) ClaimDefaultingReconcilerOption
WithDefaultingJitterer specifies the Jitterer a ClaimDefaultingReconciler should use.
type ClaimFinalizer ¶
A ClaimFinalizer finalizes the deletion of a resource claim.
type ClaimFinalizerFn ¶
A ClaimFinalizerFn is a function that satisfies the ClaimFinalizer interface.
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.
type ClaimReconcilerOption ¶
type ClaimReconcilerOption func(*ClaimReconciler)
A ClaimReconcilerOption configures a ClaimReconciler.
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 ClaimSchedulingReconciler ¶
type ClaimSchedulingReconciler struct {
// contains filtered or unexported fields
}
A ClaimSchedulingReconciler schedules resource claims to a resource class that matches their class selector. Claims are reconciled by randomly selecting a matching resource class and attempting to set it as the claim's class reference. The ClaimSchedulingReconciler is designed for use in claim scheduling controllers that race several others to schedule a claim.
func NewClaimSchedulingReconciler ¶
func NewClaimSchedulingReconciler(m manager.Manager, of ClaimKind, to ClassKind, o ...ClaimSchedulingReconcilerOption) *ClaimSchedulingReconciler
NewClaimSchedulingReconciler returns a ClaimSchedulingReconciler that schedules resource claims to a resource class that matches their class selector.
type ClaimSchedulingReconcilerOption ¶
type ClaimSchedulingReconcilerOption func(*ClaimSchedulingReconciler)
A ClaimSchedulingReconcilerOption configures a ClaimSchedulingReconciler.
func WithSchedulingJitterer ¶
func WithSchedulingJitterer(j Jitterer) ClaimSchedulingReconcilerOption
WithSchedulingJitterer specifies the Jitterer a ClaimSchedulingReconciler should use.
type Class ¶
A Class is a Kubernetes object representing configuration specifications for a managed resource.
type ClassKind ¶
type ClassKind schema.GroupVersionKind
A ClassKind contains the type metadata for a kind of resource class.
func (ClassKind) List ¶
func (k ClassKind) List() schema.GroupVersionKind
List returns the list kind associated with a ClassKind.
type ClassReferencer ¶
type ClassReferencer interface {
SetClassReference(r *corev1.ObjectReference)
GetClassReference() *corev1.ObjectReference
}
A ClassReferencer may reference a resource class.
type ClassSelector ¶
type ClassSelector interface {
SetClassSelector(s *metav1.LabelSelector)
GetClassSelector() *metav1.LabelSelector
}
A ClassSelector may reference a resource class.
type Conditioned ¶
type Conditioned interface {
SetConditions(c ...v1alpha1.Condition)
GetCondition(v1alpha1.ConditionType) v1alpha1.Condition
}
A Conditioned may have conditions set or retrieved. Conditions are typically indicate the status of both a resource and its reconciliation process.
type ConfiguratorChain ¶
type ConfiguratorChain []ManagedConfigurator
A ConfiguratorChain chains multiple configurators.
type ConnectionDetails ¶
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 in an arbitrary namespace.
type ConnectionSecretWriterTo ¶
type ConnectionSecretWriterTo interface {
SetWriteConnectionSecretToReference(r *v1alpha1.SecretReference)
GetWriteConnectionSecretToReference() *v1alpha1.SecretReference
}
A ConnectionSecretWriterTo may write a connection secret to an arbitrary namespace.
type EnqueueRequestForClaim ¶
type EnqueueRequestForClaim struct{}
EnqueueRequestForClaim enqueues a reconcile.Request for the NamespacedName of a ClaimReferencer's ClaimReference.
func (*EnqueueRequestForClaim) Create ¶
func (e *EnqueueRequestForClaim) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
Create adds a NamespacedName for the supplied CreateEvent if its Object is a ClaimReferencer.
func (*EnqueueRequestForClaim) Delete ¶
func (e *EnqueueRequestForClaim) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
Delete adds a NamespacedName for the supplied DeleteEvent if its Object is a ClaimReferencer.
func (*EnqueueRequestForClaim) Generic ¶
func (e *EnqueueRequestForClaim) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
Generic adds a NamespacedName for the supplied GenericEvent if its Object is a ClaimReferencer.
func (*EnqueueRequestForClaim) Update ¶
func (e *EnqueueRequestForClaim) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Update adds a NamespacedName for the supplied UpdateEvent if its Objects are ClaimReferencers.
type EnqueueRequestForPropagator ¶
type EnqueueRequestForPropagator struct{}
EnqueueRequestForPropagator enqueues a reconcile.Request for the NamespacedName of a propagated object, i.e. an object with propagation metadata annotations.
func (*EnqueueRequestForPropagator) Create ¶
func (e *EnqueueRequestForPropagator) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
Create adds a NamespacedName for the supplied CreateEvent if its Object is propagated.
func (*EnqueueRequestForPropagator) Delete ¶
func (e *EnqueueRequestForPropagator) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
Delete adds a NamespacedName for the supplied DeleteEvent if its Object is propagated.
func (*EnqueueRequestForPropagator) Generic ¶
func (e *EnqueueRequestForPropagator) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
Generic adds a NamespacedName for the supplied GenericEvent if its Object is propagated.
func (*EnqueueRequestForPropagator) Update ¶
func (e *EnqueueRequestForPropagator) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Update adds a NamespacedName for the supplied UpdateEvent if its Objects are propagated.
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. Called when Observe reports that the associated
// external resource does not exist.
Create(ctx context.Context, mg Managed) (ExternalCreation, error)
// Update the external resource represented by the supplied Managed
// resource, if necessary. Called unless Observe reports that the
// associated external resource is up to date.
Update(ctx context.Context, mg Managed) (ExternalUpdate, error)
// Delete the external resource upon deletion of its associated Managed
// resource. Called when the managed resource has been deleted.
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 ¶
func (e ExternalClientFns) Create(ctx context.Context, mg Managed) (ExternalCreation, error)
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 ¶
func (e ExternalClientFns) Observe(ctx context.Context, mg Managed) (ExternalObservation, error)
Observe calls plugged ObserveFn function.
func (ExternalClientFns) Update ¶
func (e ExternalClientFns) Update(ctx context.Context, mg Managed) (ExternalUpdate, error)
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 ¶
func (ec ExternalConnectorFn) Connect(ctx context.Context, mg Managed) (ExternalClient, error)
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
ResourceUpToDate 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 InitializerChain ¶
type InitializerChain []ManagedInitializer
A InitializerChain chains multiple managed initializers.
func (InitializerChain) Initialize ¶
func (cc InitializerChain) Initialize(ctx context.Context, mg Managed) error
Initialize calls each ManagedInitializer serially. It returns the first error it encounters, if any.
type Jitterer ¶
type Jitterer func()
A Jitterer sleeps for a random amount of time in order to decrease the chance of any one controller predictably winning the race to schedule claims to a class, for example because it has fewer classes to list and select from than its competitors.
type LocalConnectionSecretOwner ¶
type LocalConnectionSecretOwner interface {
metav1.Object
LocalConnectionSecretWriterTo
}
A LocalConnectionSecretOwner may create and manage a connection secret in its own namespace.
type LocalConnectionSecretWriterTo ¶
type LocalConnectionSecretWriterTo interface {
SetWriteConnectionSecretToReference(r *v1alpha1.LocalSecretReference)
GetWriteConnectionSecretToReference() *v1alpha1.LocalSecretReference
}
A LocalConnectionSecretWriterTo may write a connection secret to its own namespace.
type Managed ¶
type Managed interface {
runtime.Object
metav1.Object
ClassReferencer
ClaimReferencer
ConnectionSecretWriterTo
Reclaimer
Conditioned
Bindable
}
A Managed is a Kubernetes object representing a concrete managed resource (e.g. a CloudSQL instance).
type ManagedBinder ¶
A ManagedBinder binds a resource claim to a managed resource.
type ManagedBinderFn ¶
A ManagedBinderFn is a function that satisfies the ManagedBinder interface.
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 ¶
A ManagedConfiguratorFn is a function that satisfies the ManagedConfigurator interface.
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 ¶
A ManagedConnectionPropagatorFn is a function that satisfies 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 ¶
func (fn ManagedConnectionPublisherFns) PublishConnection(ctx context.Context, mg Managed, c ConnectionDetails) error
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 ¶
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 ¶
A ManagedCreatorFn is a function that satisfies the ManagedCreator interface.
type ManagedFinalizer ¶
A ManagedFinalizer finalizes the deletion of a resource claim.
type ManagedFinalizerFn ¶
A ManagedFinalizerFn is a function that satisfies the ManagedFinalizer interface.
type ManagedInitializer ¶
A ManagedInitializer establishes ownership of the supplied Managed resource. This typically involves the operations that are run before calling any ExternalClient methods.
type ManagedInitializerFn ¶
ManagedInitializerFn is the pluggable struct to produce objects with ManagedInitializer interface.
func (ManagedInitializerFn) Initialize ¶
func (m ManagedInitializerFn) Initialize(ctx context.Context, mg Managed) error
Initialize calls ManagedInitializerFn function.
type ManagedKind ¶
type ManagedKind schema.GroupVersionKind
A ManagedKind contains the type metadata for a kind of managed resource.
type ManagedNameAsExternalName ¶
type ManagedNameAsExternalName struct {
// contains filtered or unexported fields
}
ManagedNameAsExternalName writes the name of the managed resource to the external name annotation field in order to be used as name of the external resource in provider.
func NewManagedNameAsExternalName ¶
func NewManagedNameAsExternalName(c client.Client) *ManagedNameAsExternalName
NewManagedNameAsExternalName returns a new ManagedNameAsExternalName.
func (*ManagedNameAsExternalName) Initialize ¶
func (a *ManagedNameAsExternalName) Initialize(ctx context.Context, mg Managed) error
Initialize the given 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.
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 WithManagedInitializers ¶
func WithManagedInitializers(i ...ManagedInitializer) ManagedReconcilerOption
WithManagedInitializers specifies how the Reconciler should initialize managed resource before calling any of the ExternalClient functions.
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 ManagedReferenceResolver ¶
type ManagedReferenceResolver interface {
ResolveReferences(context.Context, CanReference) error
}
A ManagedReferenceResolver resolves the references to other managed resources, by looking them up in the Kubernetes API server. The references are the fields in the managed resource that implement AttributeReferencer interface and have `attributeReferencerTagName:"managedResourceStructTagPackageName"` tag
type ManagedReferenceResolverFn ¶
type ManagedReferenceResolverFn func(context.Context, CanReference) error
ManagedReferenceResolverFn is the pluggable struct to produce objects with ManagedReferenceResolver interface.
func (ManagedReferenceResolverFn) ResolveReferences ¶
func (m ManagedReferenceResolverFn) ResolveReferences(ctx context.Context, res CanReference) error
ResolveReferences calls ManagedReferenceResolverFn function
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.
type NopConnecter ¶
type NopConnecter struct{}
A NopConnecter does nothing.
func (*NopConnecter) Connect ¶
func (c *NopConnecter) Connect(_ context.Context, _ Managed) (ExternalClient, error)
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.
type PredicateFn ¶
A PredicateFn returns true if the supplied object should be reconciled.
func AllOf ¶
func AllOf(fn ...PredicateFn) PredicateFn
AllOf accepts objects that pass all of the supplied predicate functions.
func AnyOf ¶
func AnyOf(fn ...PredicateFn) PredicateFn
AnyOf accepts objects that pass any of the supplied predicate functions.
func HasClassReferenceKind ¶
func HasClassReferenceKind(k ClassKind) PredicateFn
HasClassReferenceKind accepts objects that reference the supplied resource class kind.
func HasClassSelector ¶
func HasClassSelector() PredicateFn
HasClassSelector accepts resource claims that do not specify a resource class selector.
func HasManagedResourceReferenceKind ¶
func HasManagedResourceReferenceKind(k ManagedKind) PredicateFn
HasManagedResourceReferenceKind accepts objects that reference the supplied managed resource kind.
func HasNoClassReference ¶
func HasNoClassReference() PredicateFn
HasNoClassReference accepts resource claims that do not reference a specific resource class.
func HasNoClassSelector ¶
func HasNoClassSelector() PredicateFn
HasNoClassSelector accepts resource claims that do not specify a resource class selector.
func HasNoManagedResourceReference ¶
func HasNoManagedResourceReference() PredicateFn
HasNoManagedResourceReference accepts resource claims that do not reference a specific managed resource.
func IsControlledByKind ¶
func IsControlledByKind(k schema.GroupVersionKind) PredicateFn
IsControlledByKind accepts objects that are controlled by a resource of the supplied kind.
func IsManagedKind ¶
func IsManagedKind(k ManagedKind, ot runtime.ObjectTyper) PredicateFn
IsManagedKind accepts objects that are of the supplied managed resource kind.
func IsPropagated ¶
func IsPropagated() PredicateFn
IsPropagated accepts objects that consent to be partially or fully propagated from another object of the same kind.
func IsPropagator ¶
func IsPropagator() PredicateFn
IsPropagator accepts objects that request to be partially or fully propagated to another object of the same kind.
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.
type ReferenceStatus ¶
type ReferenceStatus struct {
Name string
Status ReferenceStatusType
}
ReferenceStatus has the name and status of a reference
func (ReferenceStatus) String ¶
func (r ReferenceStatus) String() string
type ReferenceStatusType ¶
type ReferenceStatusType int
ReferenceStatusType is an enum type for the possible values for a Reference Status
const ( // ReferenceStatusUnknown is the default value ReferenceStatusUnknown ReferenceStatusType = iota // ReferenceNotFound shows that the reference is not found ReferenceNotFound // ReferenceNotReady shows that the reference is not ready ReferenceNotReady // ReferenceReady shows that the reference is ready ReferenceReady )
func (ReferenceStatusType) String ¶
func (t ReferenceStatusType) String() string