Documentation ¶
Overview ¶
Package resource provides types and functions that can be used to build Kubernetes controllers that reconcile Crossplane resources.
Index ¶
- Constants
- 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 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 ResolveClassClaimValues(classValue, claimValue string) (string, error)
- func SetBindable(b Bindable)
- type APIManagedConnectionPropagator
- type AttributeReferencer
- type Bindable
- type CanReference
- type Claim
- type ClaimKind
- type ClaimReferencer
- type Class
- type ClassKind
- type ClassReferencer
- type ClassSelector
- type Conditioned
- type ConnectionSecretOwner
- type ConnectionSecretWriterTo
- type CredentialsSecretReferencer
- 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 EnqueueRequestForPropagated
- func (e *EnqueueRequestForPropagated) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForPropagated) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForPropagated) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForPropagated) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type ErrorIs
- type LocalConnectionSecretOwner
- type LocalConnectionSecretWriterTo
- type Managed
- type ManagedConnectionPropagator
- type ManagedConnectionPropagatorFn
- type ManagedKind
- type ManagedResourceReferencer
- 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 Provider
- type Reclaimer
- type ReferenceStatus
- type ReferenceStatusType
- type Target
- type TargetKind
Constants ¶
const ( AnnotationKeyPropagateToPrefix = "to.propagate.crossplane.io" AnnotationKeyPropagateFromNamespace = "from.propagate.crossplane.io/namespace" AnnotationKeyPropagateFromName = "from.propagate.crossplane.io/name" AnnotationKeyPropagateFromUID = "from.propagate.crossplane.io/uid" AnnotationDelimiter = "/" )
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.
Variables ¶
This section is empty.
Functions ¶
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
func IsBound ¶
IsBound returns true if the supplied Bindable is bound to another Bindable, such as a resource claim or managed
func IsConditionTrue ¶
IsConditionTrue returns if condition status is true
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 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 by setting its binding phase to "Unbound". It is a no-op for Bindables in phases "Bound" or "Released", because these phases may not transition back to "Unbound".
Types ¶
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, o LocalConnectionSecretOwner, mg Managed) error
PropagateConnection details from the supplied resource to the supplied claim.
type AttributeReferencer ¶
type AttributeReferencer interface { // GetStatus retries the referenced resource, as well as other non-managed // resources (like a `Provider`) and reports their readiness for use as a // referenced resource. GetStatus(ctx context.Context, res CanReference, r client.Reader) ([]ReferenceStatus, error) // Build retrieves the referenced resource, as well as other non-managed // resources (like a `Provider`), and builds the referenced attribute, // returning it as a string value. Build(ctx context.Context, res CanReference, r client.Reader) (value string, err error) // Assign accepts a managed resource object, and assigns the given value to // its corresponding property. Assign(res CanReference, value string) error }
An AttributeReferencer resolves 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 ¶
A CanReference is a resource that can reference another resource in its spec in order to automatically resolve corresponding spec field values by inspecting the referenced resource.
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 ClaimKind ¶
type ClaimKind schema.GroupVersionKind
A ClaimKind contains the type metadata for a kind of resource claim.
type ClaimReferencer ¶
type ClaimReferencer interface { SetClaimReference(r *corev1.ObjectReference) GetClaimReference() *corev1.ObjectReference }
A ClaimReferencer may reference a resource claim.
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 ConnectionSecretOwner ¶
type ConnectionSecretOwner interface { runtime.Object 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 CredentialsSecretReferencer ¶ added in v0.3.0
type CredentialsSecretReferencer interface { GetCredentialsSecretReference() v1alpha1.SecretKeySelector SetCredentialsSecretReference(r v1alpha1.SecretKeySelector) }
A CredentialsSecretReferencer may refer to a credential secret in 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 EnqueueRequestForPropagated ¶ added in v0.4.0
type EnqueueRequestForPropagated struct{}
EnqueueRequestForPropagated enqueues a reconcile.Request for the NamespacedName of a propagated object, i.e. an object with propagation metadata annotations.
func (*EnqueueRequestForPropagated) Create ¶ added in v0.4.0
func (e *EnqueueRequestForPropagated) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
Create adds a NamespacedName for the supplied CreateEvent if its Object is propagated.
func (*EnqueueRequestForPropagated) Delete ¶ added in v0.4.0
func (e *EnqueueRequestForPropagated) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
Delete adds a NamespacedName for the supplied DeleteEvent if its Object is propagated.
func (*EnqueueRequestForPropagated) Generic ¶ added in v0.4.0
func (e *EnqueueRequestForPropagated) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
Generic adds a NamespacedName for the supplied GenericEvent if its Object is propagated.
func (*EnqueueRequestForPropagated) Update ¶ added in v0.4.0
func (e *EnqueueRequestForPropagated) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Update adds a NamespacedName for the supplied UpdateEvent if its Objects are propagated.
type LocalConnectionSecretOwner ¶
type LocalConnectionSecretOwner interface { runtime.Object 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 ManagedConnectionPropagator ¶
type ManagedConnectionPropagator interface {
PropagateConnection(ctx context.Context, o LocalConnectionSecretOwner, 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, o LocalConnectionSecretOwner, mg Managed) error
A ManagedConnectionPropagatorFn is a function that satisfies the ManagedConnectionPropagator interface.
func (ManagedConnectionPropagatorFn) PropagateConnection ¶
func (fn ManagedConnectionPropagatorFn) PropagateConnection(ctx context.Context, o LocalConnectionSecretOwner, mg Managed) error
PropagateConnection information from the supplied managed resource to the supplied resource claim.
type ManagedKind ¶
type ManagedKind schema.GroupVersionKind
A ManagedKind contains the type metadata for a kind of managed
type ManagedResourceReferencer ¶
type ManagedResourceReferencer interface { SetResourceReference(r *corev1.ObjectReference) GetResourceReference() *corev1.ObjectReference }
A ManagedResourceReferencer may reference a concrete managed resource.
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 Provider ¶ added in v0.3.0
type Provider interface { runtime.Object metav1.Object CredentialsSecretReferencer }
A Provider is a Kubernetes object that refers to credentials to connect to an external system.
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 ReferenceStatusType = iota ReferenceNotFound ReferenceNotReady ReferenceReady )
Reference statuses.
func (ReferenceStatusType) String ¶
func (t ReferenceStatusType) String() string
type Target ¶ added in v0.4.0
type Target interface { runtime.Object metav1.Object LocalConnectionSecretWriterTo ManagedResourceReferencer Conditioned }
A Target is a Kubernetes object that refers to credentials to connect to a deployment target. Target is a subset of the Claim interface.
type TargetKind ¶ added in v0.4.0
type TargetKind schema.GroupVersionKind
A TargetKind contains the type metadata for a kind of target resource.