Documentation ¶
Overview ¶
Package claim implements composite resource claims.
Index ¶
- Constants
- func ControllerName(name string) string
- func Waiting() xpv1.Condition
- type APIConnectionPropagator
- type ClientSideCompositeSyncer
- type CompositeSyncer
- type CompositeSyncerFn
- type ConnectionPropagator
- type ConnectionPropagatorChain
- type ConnectionPropagatorFn
- type ConnectionUnpublisher
- type ConnectionUnpublisherFn
- type DefaultsSelector
- type DefaultsSelectorFn
- type ManagedFieldsUpgrader
- type NopConnectionUnpublisher
- type NopManagedFieldsUpgrader
- type PatchingManagedFieldsUpgrader
- type Reconciler
- type ReconcilerOption
- func WithClaimFinalizer(f resource.Finalizer) ReconcilerOption
- func WithClient(c client.Client) ReconcilerOption
- func WithCompositeSyncer(cs CompositeSyncer) ReconcilerOption
- func WithConnectionPropagator(p ConnectionPropagator) ReconcilerOption
- func WithConnectionUnpublisher(u ConnectionUnpublisher) ReconcilerOption
- func WithLogger(l logging.Logger) ReconcilerOption
- func WithManagedFieldsUpgrader(u ManagedFieldsUpgrader) ReconcilerOption
- func WithPollInterval(after time.Duration) ReconcilerOption
- func WithRecorder(er event.Recorder) ReconcilerOption
- type SecretStoreConnectionUnpublisher
- type ServerSideCompositeSyncer
Constants ¶
const ( // FieldOwnerXR owns the fields this controller mutates on composite // resources (XRs). FieldOwnerXR = "apiextensions.crossplane.io/claim" )
Server-side-apply field owners.
Variables ¶
This section is empty.
Functions ¶
func ControllerName ¶
ControllerName returns the recommended name for controllers that use this package to reconcile a particular kind of composite resource claim.
Types ¶
type APIConnectionPropagator ¶
type APIConnectionPropagator struct {
// contains filtered or unexported fields
}
An APIConnectionPropagator propagates connection details by reading them from and writing them to a Kubernetes API server.
func NewAPIConnectionPropagator ¶
func NewAPIConnectionPropagator(c client.Client) *APIConnectionPropagator
NewAPIConnectionPropagator returns a new APIConnectionPropagator.
func (*APIConnectionPropagator) PropagateConnection ¶
func (a *APIConnectionPropagator) PropagateConnection(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (bool, error)
PropagateConnection details from the supplied resource.
type ClientSideCompositeSyncer ¶ added in v1.15.0
type ClientSideCompositeSyncer struct {
// contains filtered or unexported fields
}
A ClientSideCompositeSyncer binds and syncs a claim with a composite resource (XR). It uses client-side apply to update the claim and the composite.
func NewClientSideCompositeSyncer ¶ added in v1.15.0
func NewClientSideCompositeSyncer(c client.Client, ng names.NameGenerator) *ClientSideCompositeSyncer
NewClientSideCompositeSyncer returns a CompositeSyncer that uses client-side apply to sync a claim with a composite resource.
func (*ClientSideCompositeSyncer) Sync ¶ added in v1.15.0
func (s *ClientSideCompositeSyncer) Sync(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error
Sync the supplied claim with the supplied composite resource (XR). Syncing may involve creating and binding the XR.
type CompositeSyncer ¶ added in v1.15.0
type CompositeSyncer interface {
Sync(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error
}
A CompositeSyncer binds and syncs the supplied claim with the supplied composite resource (XR).
type CompositeSyncerFn ¶ added in v1.15.0
type CompositeSyncerFn func(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error
A CompositeSyncerFn binds and syncs the supplied claim with the supplied composite resource (XR).
func (CompositeSyncerFn) Sync ¶ added in v1.15.0
func (fn CompositeSyncerFn) Sync(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error
Sync the supplied claim with the supplied composite resource..
type ConnectionPropagator ¶
type ConnectionPropagator interface {
PropagateConnection(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error)
}
A ConnectionPropagator is responsible for propagating information required to connect to a resource.
type ConnectionPropagatorChain ¶ added in v1.7.0
type ConnectionPropagatorChain []ConnectionPropagator
A ConnectionPropagatorChain runs multiple connection propagators.
func (ConnectionPropagatorChain) PropagateConnection ¶ added in v1.7.0
func (pc ConnectionPropagatorChain) PropagateConnection(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error)
PropagateConnection details from one resource to the other. This method calls PropagateConnection for all ConnectionPropagator's in the chain and returns propagated if at least one ConnectionPropagator propagates the connection details but exits with an error if any of them fails without calling the remaining ones.
type ConnectionPropagatorFn ¶
type ConnectionPropagatorFn func(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error)
A ConnectionPropagatorFn is responsible for propagating information required to connect to a resource.
func (ConnectionPropagatorFn) PropagateConnection ¶
func (fn ConnectionPropagatorFn) PropagateConnection(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error)
PropagateConnection details from one resource to the other.
type ConnectionUnpublisher ¶ added in v1.7.0
type ConnectionUnpublisher interface { // UnpublishConnection details for the supplied Managed resource. UnpublishConnection(ctx context.Context, so resource.LocalConnectionSecretOwner, c managed.ConnectionDetails) error }
A ConnectionUnpublisher is responsible for cleaning up connection secret.
type ConnectionUnpublisherFn ¶ added in v1.7.0
type ConnectionUnpublisherFn func(ctx context.Context, so resource.LocalConnectionSecretOwner, c managed.ConnectionDetails) error
A ConnectionUnpublisherFn is responsible for cleaning up connection secret.
func (ConnectionUnpublisherFn) UnpublishConnection ¶ added in v1.7.0
func (fn ConnectionUnpublisherFn) UnpublishConnection(ctx context.Context, so resource.LocalConnectionSecretOwner, c managed.ConnectionDetails) error
UnpublishConnection details of a local connection secret owner.
type DefaultsSelector ¶ added in v1.12.0
type DefaultsSelector interface { // SelectDefaults from CompositeResourceDefinition when needed. SelectDefaults(ctx context.Context, cm resource.CompositeClaim) error }
A DefaultsSelector copies default values from the CompositeResourceDefinition when the corresponding field in the Claim is not set.
type DefaultsSelectorFn ¶ added in v1.12.0
type DefaultsSelectorFn func(ctx context.Context, cm resource.CompositeClaim) error
A DefaultsSelectorFn is responsible for copying default values from the CompositeResourceDefinition.
func (DefaultsSelectorFn) SelectDefaults ¶ added in v1.12.0
func (fn DefaultsSelectorFn) SelectDefaults(ctx context.Context, cm resource.CompositeClaim) error
SelectDefaults copies default values from the XRD if necessary.
type ManagedFieldsUpgrader ¶ added in v1.15.0
type ManagedFieldsUpgrader interface {
Upgrade(ctx context.Context, obj client.Object, ssaManager string) error
}
A ManagedFieldsUpgrader upgrades an objects managed fields from client-side apply to server-side apply. This is necessary when an object was previously managed using client-side apply, but should now be managed using server-side apply. See https://github.com/kubernetes/kubernetes/issues/99003 for details.
type NopConnectionUnpublisher ¶ added in v1.7.0
type NopConnectionUnpublisher struct{}
NopConnectionUnpublisher is a ConnectionUnpublisher that does nothing.
func NewNopConnectionUnpublisher ¶ added in v1.7.0
func NewNopConnectionUnpublisher() *NopConnectionUnpublisher
NewNopConnectionUnpublisher returns a new NopConnectionUnpublisher.
func (*NopConnectionUnpublisher) UnpublishConnection ¶ added in v1.7.0
func (n *NopConnectionUnpublisher) UnpublishConnection(_ context.Context, _ resource.LocalConnectionSecretOwner, _ managed.ConnectionDetails) error
UnpublishConnection does nothing and returns no error with UnpublishConnection. Expected to be used where deletion of connection secret is already handled by K8s garbage collection and there is actually nothing to do to unpublish connection details.
type NopManagedFieldsUpgrader ¶ added in v1.15.0
type NopManagedFieldsUpgrader struct{}
A NopManagedFieldsUpgrader does nothing.
type PatchingManagedFieldsUpgrader ¶ added in v1.15.0
type PatchingManagedFieldsUpgrader struct {
// contains filtered or unexported fields
}
A PatchingManagedFieldsUpgrader uses a JSON patch to upgrade an object's managed fields from client-side to server-side apply. The upgrade is a no-op if the object does not need upgrading.
func NewPatchingManagedFieldsUpgrader ¶ added in v1.15.0
func NewPatchingManagedFieldsUpgrader(w client.Writer) *PatchingManagedFieldsUpgrader
NewPatchingManagedFieldsUpgrader returns a ManagedFieldsUpgrader that uses a JSON patch to upgrade and object's managed fields from client-side to server-side apply.
func (*PatchingManagedFieldsUpgrader) Upgrade ¶ added in v1.15.0
func (u *PatchingManagedFieldsUpgrader) Upgrade(ctx context.Context, obj client.Object, ssaManager string) error
Upgrade the supplied object's field managers from client-side to server-side apply.
This is a multi-step process.
Step 1: All fields are owned by either manager 'crossplane', operation 'Update' or manager 'apiextensions.crossplane.io/composite', operation 'Apply'. This represents all fields set by the claim or XR controller up to this point.
Step 2: Upgrade is called for the first time. We delete all field managers.
Step 3: The claim controller server-side applies its fully specified intent as field manager 'apiextensions.crossplane.io/claim'. This becomes the manager of all the fields that are part of the claim controller's fully specified intent. All existing fields the claim controller didn't specify become owned by a special manager - 'before-first-apply', operation 'Update'.
Step 4: Upgrade is called for the second time. It deletes the 'before-first-apply' field manager entry. Only the claim field manager remains.
Step 5: Eventually the XR reconciler updates a field (e.g. spec.resourceRefs) and becomes owner of that field.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
A Reconciler reconciles claims by creating exactly one kind of composite resource (XR). Each claim kind should create an instance of this controller for each XR kind they can bind to. Each controller must watch its subset of claims and any XRs they bind to.
func NewReconciler ¶
func NewReconciler(m manager.Manager, of resource.CompositeClaimKind, with resource.CompositeKind, o ...ReconcilerOption) *Reconciler
NewReconciler returns a Reconciler that reconciles composite resource claims of the supplied CompositeClaimKind with resources of the supplied CompositeKind. The returned Reconciler will apply only the ObjectMetaConfigurator by default; most callers should supply one or more CompositeConfigurators to configure their composite resources.
type ReconcilerOption ¶
type ReconcilerOption func(*Reconciler)
A ReconcilerOption configures a Reconciler.
func WithClaimFinalizer ¶
func WithClaimFinalizer(f resource.Finalizer) ReconcilerOption
WithClaimFinalizer specifies which ClaimFinalizer should be used to finalize claims when they are deleted.
func WithClient ¶ added in v1.15.0
func WithClient(c client.Client) ReconcilerOption
WithClient specifies how the Reconciler should interact with the Kubernetes API.
func WithCompositeSyncer ¶ added in v1.15.0
func WithCompositeSyncer(cs CompositeSyncer) ReconcilerOption
WithCompositeSyncer specifies how the Reconciler should sync claims with composite resources (XRs).
func WithConnectionPropagator ¶
func WithConnectionPropagator(p ConnectionPropagator) ReconcilerOption
WithConnectionPropagator specifies which ConnectionPropagator should be used to propagate resource connection details to their claim.
func WithConnectionUnpublisher ¶ added in v1.7.0
func WithConnectionUnpublisher(u ConnectionUnpublisher) ReconcilerOption
WithConnectionUnpublisher specifies which ConnectionUnpublisher should be used to unpublish resource connection details.
func WithLogger ¶
func WithLogger(l logging.Logger) ReconcilerOption
WithLogger specifies how the Reconciler should log messages.
func WithManagedFieldsUpgrader ¶ added in v1.15.0
func WithManagedFieldsUpgrader(u ManagedFieldsUpgrader) ReconcilerOption
WithManagedFieldsUpgrader specifies how the Reconciler should upgrade claim and composite resource (XR) managed fields from client-side apply to server-side apply.
func WithPollInterval ¶ added in v1.11.1
func WithPollInterval(after time.Duration) ReconcilerOption
WithPollInterval specifies how long the Reconciler should wait before queueing a new reconciliation after a successful reconcile. The Reconciler requeues after a specified duration when it is not actively waiting for an external operation, but wishes to check whether resources it does not have a watch on (i.e. composed resources) need to be reconciled.
func WithRecorder ¶
func WithRecorder(er event.Recorder) ReconcilerOption
WithRecorder specifies how the Reconciler should record events.
type SecretStoreConnectionUnpublisher ¶ added in v1.7.0
type SecretStoreConnectionUnpublisher struct {
// contains filtered or unexported fields
}
SecretStoreConnectionUnpublisher unpublishes secret store connection secrets.
func NewSecretStoreConnectionUnpublisher ¶ added in v1.7.0
func NewSecretStoreConnectionUnpublisher(p managed.ConnectionPublisher) *SecretStoreConnectionUnpublisher
NewSecretStoreConnectionUnpublisher returns a new SecretStoreConnectionUnpublisher.
func (*SecretStoreConnectionUnpublisher) UnpublishConnection ¶ added in v1.7.0
func (u *SecretStoreConnectionUnpublisher) UnpublishConnection(ctx context.Context, so resource.LocalConnectionSecretOwner, c managed.ConnectionDetails) error
UnpublishConnection details for the supplied Managed resource.
type ServerSideCompositeSyncer ¶ added in v1.15.0
type ServerSideCompositeSyncer struct {
// contains filtered or unexported fields
}
A ServerSideCompositeSyncer binds and syncs a claim with a composite resource (XR). It uses server-side apply to update the XR.
func NewServerSideCompositeSyncer ¶ added in v1.15.0
func NewServerSideCompositeSyncer(c client.Client, ng names.NameGenerator) *ServerSideCompositeSyncer
NewServerSideCompositeSyncer returns a CompositeSyncer that uses server-side apply to sync a claim with a composite resource.
func (*ServerSideCompositeSyncer) Sync ¶ added in v1.15.0
func (s *ServerSideCompositeSyncer) Sync(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error
Sync the supplied claim with the supplied composite resource (XR). Syncing may involve creating and binding the XR.