Documentation ¶
Overview ¶
Package claimbinding provides a resource claim binding reconciler.
Index ¶
- Constants
- func Binding() v1alpha1.Condition
- func ConfigureNames(_ context.Context, cm resource.Claim, _ resource.Class, mg resource.Managed) error
- func ConfigureReclaimPolicy(_ context.Context, _ resource.Claim, cs resource.Class, mg resource.Managed) error
- func ControllerName(kind string) string
- type APIBinder
- type APIManagedCreator
- type APIStatusBinder
- type Binder
- type BinderFns
- type ConfiguratorChain
- type ManagedConfigurator
- type ManagedConfiguratorFn
- type ManagedCreator
- type ManagedCreatorFn
- type ObjectMetaConfigurator
- type Reconciler
- type ReconcilerOption
- func WithBinder(b Binder) ReconcilerOption
- func WithClaimFinalizer(f resource.Finalizer) ReconcilerOption
- func WithConnectionPropagator(p resource.ConnectionPropagator) ReconcilerOption
- func WithLogger(l logging.Logger) ReconcilerOption
- func WithManagedConfigurators(c ...ManagedConfigurator) ReconcilerOption
- func WithManagedConnectionPropagator(p resource.ManagedConnectionPropagator) ReconcilerOptiondeprecated
- func WithManagedCreator(c ManagedCreator) ReconcilerOption
- func WithRecorder(er event.Recorder) ReconcilerOption
Constants ¶
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 ConfigureNames ¶
func ConfigureNames(_ context.Context, cm resource.Claim, _ resource.Class, mg resource.Managed) error
ConfigureNames configures the name and external name of the supplied managed resource. The managed resource name is derived from the supplied resource claim, in the form {claim-namespace}-{claim-name}-{random-string}. The resource claim's external name annotation, if any, is propagated to the managed resource.
func ConfigureReclaimPolicy ¶
func ConfigureReclaimPolicy(_ context.Context, _ resource.Claim, cs resource.Class, mg resource.Managed) error
ConfigureReclaimPolicy configures the reclaim policy of the supplied managed resource. If the managed resource _already has_ a reclaim policy (for example because one was set by another configurator) it is respected. Otherwise the reclaim policy is copied from the resource class. If the resource class does not specify a reclaim policy, the managed resource's policy is set to "Delete".
func ControllerName ¶
ControllerName returns the recommended name for controllers that use this package to reconcile a particular kind of resource claim.
Types ¶
type APIBinder ¶
type APIBinder struct {
// contains filtered or unexported fields
}
An APIBinder binds resources to claims by updating them in a Kubernetes API server. Note that APIBinder does not support objects using the status subresource; such objects should use APIStatusBinder.
func NewAPIBinder ¶
func NewAPIBinder(c client.Client, t runtime.ObjectTyper) *APIBinder
NewAPIBinder returns a new APIBinder.
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 APIStatusBinder ¶
type APIStatusBinder struct {
// contains filtered or unexported fields
}
An APIStatusBinder binds resources to claims by updating them in a Kubernetes API server. Note that APIStatusBinder does not support objects that do not use the status subresource; such objects should use APIBinder.
func NewAPIStatusBinder ¶
func NewAPIStatusBinder(c client.Client, t runtime.ObjectTyper) *APIStatusBinder
NewAPIStatusBinder returns a new APIStatusBinder.
type Binder ¶
type Binder interface { // Bind the supplied Claim to the supplied Managed resource. Bind(ctx context.Context, cm resource.Claim, mg resource.Managed) error // Unbind the supplied Claim from the supplied Managed resource. Unbind(ctx context.Context, cm resource.Claim, mg resource.Managed) error }
A Binder binds a resource claim to a managed resource.
type BinderFns ¶
type BinderFns struct { BindFn func(ctx context.Context, cm resource.Claim, mg resource.Managed) error UnbindFn func(ctx context.Context, cm resource.Claim, mg resource.Managed) error }
BinderFns satisfy the Binder interface.
type ConfiguratorChain ¶
type ConfiguratorChain []ManagedConfigurator
A ConfiguratorChain chains multiple configurators.
type ManagedConfigurator ¶
type ManagedConfigurator interface {
Configure(ctx context.Context, cm resource.Claim, cs resource.Class, mg resource.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 resource.Claim, cs resource.Class, mg resource.Managed) error
A ManagedConfiguratorFn is a function that satisfies the ManagedConfigurator interface.
type ManagedCreator ¶
type ManagedCreator interface {
Create(ctx context.Context, cm resource.Claim, cs resource.Class, mg resource.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 resource.Claim, cs resource.Class, mg resource.Managed) error
A ManagedCreatorFn is a function that satisfies the ManagedCreator interface.
type ObjectMetaConfigurator ¶
type ObjectMetaConfigurator struct{}
An ObjectMetaConfigurator sets standard object metadata for a dynamically provisioned resource, deriving it from a class and claim. It is deprecated; use ConfigureNames instead.
func NewObjectMetaConfigurator ¶
func NewObjectMetaConfigurator(_ runtime.ObjectTyper) *ObjectMetaConfigurator
NewObjectMetaConfigurator returns a new ObjectMetaConfigurator.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
A Reconciler 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 NewReconciler ¶
func NewReconciler(m manager.Manager, of resource.ClaimKind, using resource.ClassKind, with resource.ManagedKind, o ...ReconcilerOption) *Reconciler
NewReconciler returns a Reconciler 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 Reconciler will apply only the ObjectMetaConfigurator by default; most callers should supply one or more ManagedConfigurators to configure their managed resources.
type ReconcilerOption ¶
type ReconcilerOption func(*Reconciler)
A ReconcilerOption configures a Reconciler.
func WithBinder ¶
func WithBinder(b Binder) ReconcilerOption
WithBinder specifies which Binder should be used to bind resources to their claim.
func WithClaimFinalizer ¶
func WithClaimFinalizer(f resource.Finalizer) ReconcilerOption
WithClaimFinalizer specifies which ClaimFinalizer should be used to finalize claims when they are deleted.
func WithConnectionPropagator ¶ added in v0.8.0
func WithConnectionPropagator(p resource.ConnectionPropagator) ReconcilerOption
WithConnectionPropagator specifies which ConnectionPropagator should be used to propagate resource connection details to their claim.
func WithLogger ¶
func WithLogger(l logging.Logger) ReconcilerOption
WithLogger specifies how the Reconciler should log messages.
func WithManagedConfigurators ¶
func WithManagedConfigurators(c ...ManagedConfigurator) ReconcilerOption
WithManagedConfigurators specifies which configurators should be used to configure each managed resource. Configurators will be applied in the order they are specified.
func WithManagedConnectionPropagator
deprecated
func WithManagedConnectionPropagator(p resource.ManagedConnectionPropagator) ReconcilerOption
WithManagedConnectionPropagator specifies which ManagedConnectionPropagator should be used to propagate resource connection details to their claim.
Deprecated: Use WithConnectionPropagator.
func WithManagedCreator ¶
func WithManagedCreator(c ManagedCreator) ReconcilerOption
WithManagedCreator specifies which ManagedCreator should be used to create managed resources.
func WithRecorder ¶
func WithRecorder(er event.Recorder) ReconcilerOption
WithRecorder specifies how the Reconciler should record events.