Documentation ¶
Overview ¶
Package composite implements Crossplane composite resources.
Index ¶
- Constants
- func Apply(p v1.Patch, cp resource.Composite, cd resource.Composed, only ...v1.PatchType) error
- func ApplyCombineFromVariablesPatch(p v1.Patch, from, to runtime.Object) error
- func ApplyEnvironmentPatch(p v1.EnvironmentPatch, cp, env runtime.Object) error
- func ApplyFromFieldPathPatch(p v1.Patch, from, to runtime.Object) error
- func ApplyToObjects(p v1.Patch, cp, cd runtime.Object, only ...v1.PatchType) error
- func AsState(xr resource.Composite, xc managed.ConnectionDetails, rs ComposedResourceStates) (*v1beta1.State, error)
- func AsStruct(o runtime.Object) (*structpb.Struct, error)
- func Combine(c v1.Combine, vars []any) (any, error)
- func CombineString(format string, vars []any) (any, error)
- func ComposedFieldOwnerName(xr *composite.Unstructured) string
- func ComposedTemplates(pss []v1.PatchSet, cts []v1.ComposedTemplate) ([]v1.ComposedTemplate, error)
- func ControllerName(name string) string
- func EnqueueForCompositionRevisionFunc(of resource.CompositeKind, ...) func(ctx context.Context, createEvent runtimeevent.CreateEvent, ...)
- func ExtractConnectionDetails(cd resource.Composed, data managed.ConnectionDetails, ...) (managed.ConnectionDetails, error)
- func FromStruct(o client.Object, s *structpb.Struct) error
- func GetConversionFunc(t *v1.ConvertTransform, from v1.TransformIOType) (func(any) (any, error), error)
- func IsOptionalFieldPathNotFound(err error, p *v1.PatchPolicy) bool
- func IsReady(_ context.Context, o ConditionedObject, rc ...ReadinessCheck) (bool, error)
- func Matches(p v1.MatchTransformPattern, input any) (bool, error)
- func RenderComposedResourceMetadata(cd, xr resource.Object, n ResourceName) error
- func RenderFromCompositeAndEnvironmentPatches(cd resource.Composed, xr resource.Composite, e *Environment, p []v1.Patch) error
- func RenderFromJSON(o resource.Object, data []byte) error
- func RenderToCompositePatches(xr resource.Composite, cd resource.Composed, p []v1.Patch) error
- func Resolve(t v1.Transform, input any) (any, error)
- func ResolveConvert(t v1.ConvertTransform, input any) (any, error)
- func ResolveLabelValue(m v1.EnvironmentSourceSelectorLabelMatcher, cp runtime.Object) (string, error)
- func ResolveMap(t v1.MapTransform, input any) (any, error)
- func ResolveMatch(t v1.MatchTransform, input any) (any, error)
- func ResolveMath(t v1.MathTransform, input any) (any, error)
- func ResolveString(t v1.StringTransform, input any) (string, error)
- func ResolveTransforms(c v1.Patch, input any) (any, error)
- func SetCompositionResourceName(o metav1.Object, n ResourceName)
- func UpdateResourceRefs(xr resource.ComposedResourcesReferencer, desired ComposedResourceStates)
- type APIConfigurator
- type APIDefaultCompositionSelector
- type APIEnvironmentFetcher
- type APIEnvironmentSelector
- type APIFilteredSecretPublisher
- type APILabelSelectorResolver
- type APINamingConfigurator
- type APIRevisionFetcher
- type ComposedResource
- type ComposedResourceGarbageCollector
- type ComposedResourceGarbageCollectorFn
- type ComposedResourceObserver
- type ComposedResourceObserverFn
- type ComposedResourceState
- type ComposedResourceStates
- type ComposedResourceTemplates
- type Composer
- type ComposerFn
- type ComposerSelectorFn
- type CompositionRequest
- type CompositionResult
- type CompositionRevisionFetcher
- type CompositionRevisionFetcherFn
- type CompositionRevisionValidator
- type CompositionRevisionValidatorFn
- type CompositionSelector
- type CompositionSelectorChain
- type CompositionSelectorFn
- type CompositionTemplateAssociator
- type CompositionTemplateAssociatorFn
- type ConditionedObject
- type Configurator
- type ConfiguratorChain
- type ConfiguratorFn
- type ConnectionDetailExtractConfig
- type ConnectionDetailType
- type ConnectionDetailsExtractor
- type ConnectionDetailsExtractorFn
- type ConnectionDetailsFetcherChain
- type ConnectionDetailsFetcherFn
- type ConnectionSecretFilterer
- type DeletingComposedResourceGarbageCollector
- type EnforcedCompositionSelector
- type Environment
- type EnvironmentFetcher
- type EnvironmentFetcherFn
- type EnvironmentFetcherRequest
- type EnvironmentSelector
- type EnvironmentSelectorFn
- type ExistingComposedResourceObserver
- type ExistingExtraResourcesFetcher
- type ExtraResourcesFetcher
- type ExtraResourcesFetcherFn
- type FunctionComposer
- type FunctionComposerOption
- func WithComposedResourceGarbageCollector(d ComposedResourceGarbageCollector) FunctionComposerOption
- func WithComposedResourceObserver(g ComposedResourceObserver) FunctionComposerOption
- func WithCompositeConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) FunctionComposerOption
- func WithExtraResourcesFetcher(f ExtraResourcesFetcher) FunctionComposerOption
- type FunctionRunner
- type FunctionRunnerFn
- type GarbageCollectingAssociator
- type KindObserver
- type KindObserverFunc
- type MatchConditionReadinessCheck
- type NilEnvironmentFetcher
- type NoopEnvironmentSelector
- type Observation
- type PTComposer
- type PTComposerOption
- func WithComposedConnectionDetailsExtractor(e ConnectionDetailsExtractor) PTComposerOption
- func WithComposedConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) PTComposerOption
- func WithComposedNameGenerator(r names.NameGenerator) PTComposerOption
- func WithComposedReadinessChecker(r ReadinessChecker) PTComposerOption
- func WithTemplateAssociator(a CompositionTemplateAssociator) PTComposerOption
- type ReadinessCheck
- type ReadinessCheckType
- type ReadinessChecker
- type ReadinessCheckerFn
- type Reconciler
- type ReconcilerOption
- func WithClient(c client.Client) ReconcilerOption
- func WithComposer(c Composer) ReconcilerOption
- func WithCompositeFinalizer(f resource.Finalizer) ReconcilerOption
- func WithCompositionRevisionFetcher(f CompositionRevisionFetcher) ReconcilerOption
- func WithCompositionRevisionValidator(v CompositionRevisionValidator) ReconcilerOption
- func WithCompositionSelector(s CompositionSelector) ReconcilerOption
- func WithConfigurator(c Configurator) ReconcilerOption
- func WithConnectionPublishers(p ...managed.ConnectionPublisher) ReconcilerOption
- func WithEnvironmentFetcher(f EnvironmentFetcher) ReconcilerOption
- func WithEnvironmentSelector(s EnvironmentSelector) ReconcilerOption
- func WithKindObserver(o KindObserver) ReconcilerOption
- func WithLogger(log logging.Logger) ReconcilerOption
- func WithPollInterval(after time.Duration) ReconcilerOption
- func WithRecorder(er event.Recorder) ReconcilerOption
- type ResourceName
- type SecretConnectionDetailsFetcher
- type SecretStoreConnectionDetailsConfigurator
- type SecretStoreConnectionPublisher
- type TemplateAssociation
Constants ¶
const ( // FieldOwnerXR owns the fields this controller mutates on composite // resources (XR). FieldOwnerXR = "apiextensions.crossplane.io/composite" // FieldOwnerComposedPrefix owns the fields this controller mutates on composed // resources. FieldOwnerComposedPrefix = "apiextensions.crossplane.io/composed" )
Server-side-apply field owners. We need two of these because it's possible an invocation of this controller will operate on the same resource in two different contexts. For example if an XR composes another XR we'll spin up two XR controllers. The 'parent' XR controller will treat the child XR as a composed resource, while the child XR controller will treat it as an XR. The controller owns different parts of the resource (i.e. has different fully specified intent) depending on the context.
const (
AnnotationKeyCompositionResourceName = "crossplane.io/composition-resource-name"
)
Annotation keys.
const ( // FunctionContextKeyEnvironment is used to store the Composition // Environment in the Function context. FunctionContextKeyEnvironment = "apiextensions.crossplane.io/environment" )
const ( // MaxRequirementsIterations is the maximum number of times a Function should be called, // limiting the number of times it can request for extra resources, capped for // safety. MaxRequirementsIterations = 5 )
Variables ¶
This section is empty.
Functions ¶
func Apply ¶ added in v1.11.0
Apply executes a patching operation between the from and to resources. Applies all patch types unless an 'only' filter is supplied.
func ApplyCombineFromVariablesPatch ¶ added in v1.11.0
ApplyCombineFromVariablesPatch patches the "to" resource, taking a list of input variables and combining them into a single output value. The single output value may then be further transformed if they are defined on the patch.
func ApplyEnvironmentPatch ¶ added in v1.11.0
func ApplyEnvironmentPatch(p v1.EnvironmentPatch, cp, env runtime.Object) error
ApplyEnvironmentPatch executes a patching operation between the cp and env objects.
func ApplyFromFieldPathPatch ¶ added in v1.11.0
ApplyFromFieldPathPatch patches the "to" resource, using a source field on the "from" resource. Values may be transformed if any are defined on the patch.
func ApplyToObjects ¶ added in v1.11.0
ApplyToObjects works like c.Apply but accepts any kind of runtime.Object (such as EnvironmentConfigs). It might be vulnerable to conversion panics (see https://github.com/crossplane/crossplane/pull/3394 for details).
func AsState ¶ added in v1.14.0
func AsState(xr resource.Composite, xc managed.ConnectionDetails, rs ComposedResourceStates) (*v1beta1.State, error)
AsState builds state for a RunFunctionRequest from the XR and composed resources.
func AsStruct ¶ added in v1.14.0
AsStruct converts the supplied object to a protocol buffer Struct well-known type.
func CombineString ¶ added in v1.11.0
CombineString returns a single output by running a string format with all of its input variables.
func ComposedFieldOwnerName ¶ added in v1.14.8
func ComposedFieldOwnerName(xr *composite.Unstructured) string
ComposedFieldOwnerName generates a unique field owner name for a given Crossplane composite resource (XR). This uniqueness is crucial to prevent multiple XRs, which compose the same resource, from continuously alternating as controllers.
The function generates a deterministic hash based on the XR's name and GroupKind (GK), ensuring consistency even during system restores. The hash does not include the XR's UID (as it's not deterministic), namespace (XRs don't have one), or version (to allow version changes without needing to update the field owner name).
We decided to include the GK in the hash to prevent transferring ownership of composed resources across XRs with whole new GK, as that should not be supported without manual intervention.
Given that field owner names are limited to 128 characters, the function truncates the hash to 32 characters. A longer hash was deemed unnecessary.
func ComposedTemplates ¶ added in v1.11.0
func ComposedTemplates(pss []v1.PatchSet, cts []v1.ComposedTemplate) ([]v1.ComposedTemplate, error)
ComposedTemplates returns the supplied composed resource templates with any supplied patchsets dereferenced.
func ControllerName ¶
ControllerName returns the recommended name for controllers that use this package to reconcile a particular kind of composite resource.
func EnqueueForCompositionRevisionFunc ¶ added in v1.14.0
func EnqueueForCompositionRevisionFunc(of resource.CompositeKind, list func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error, log logging.Logger) func(ctx context.Context, createEvent runtimeevent.CreateEvent, q workqueue.RateLimitingInterface)
EnqueueForCompositionRevisionFunc returns a function that enqueues (the related) XRs when a new CompositionRevision is created. This speeds up reconciliation of XRs on changes to the Composition by not having to wait for the 60s sync period, but be instant.
func ExtractConnectionDetails ¶ added in v1.11.0
func ExtractConnectionDetails(cd resource.Composed, data managed.ConnectionDetails, cfg ...ConnectionDetailExtractConfig) (managed.ConnectionDetails, error)
ExtractConnectionDetails extracts XR connection details from the supplied composed resource. If no ExtractConfigs are supplied no connection details will be returned.
func FromStruct ¶ added in v1.14.0
FromStruct populates the supplied object with content loaded from the Struct.
func GetConversionFunc ¶ added in v1.12.0
func GetConversionFunc(t *v1.ConvertTransform, from v1.TransformIOType) (func(any) (any, error), error)
GetConversionFunc returns the conversion function for the given input and output types, or an error if no conversion is supported. Will return a no-op conversion if the input and output types are the same.
func IsOptionalFieldPathNotFound ¶ added in v1.11.0
func IsOptionalFieldPathNotFound(err error, p *v1.PatchPolicy) bool
IsOptionalFieldPathNotFound returns true if the supplied error indicates a field path was not found, and the supplied policy indicates a patch from that field path was optional.
func IsReady ¶
func IsReady(_ context.Context, o ConditionedObject, rc ...ReadinessCheck) (bool, error)
IsReady returns whether the composed resource is ready.
func Matches ¶ added in v1.11.0
func Matches(p v1.MatchTransformPattern, input any) (bool, error)
Matches returns true if the pattern matches the supplied input.
func RenderComposedResourceMetadata ¶ added in v1.14.0
func RenderComposedResourceMetadata(cd, xr resource.Object, n ResourceName) error
RenderComposedResourceMetadata derives composed resource metadata from the supplied composite resource. It makes the composite resource the controller of the composed resource. It should run toward the end of a render pipeline to ensure that a Composition cannot influence the controller reference.
func RenderFromCompositeAndEnvironmentPatches ¶ added in v1.14.3
func RenderFromCompositeAndEnvironmentPatches(cd resource.Composed, xr resource.Composite, e *Environment, p []v1.Patch) error
RenderFromCompositeAndEnvironmentPatches renders the supplied composed resource by applying all patches that are _from_ the supplied composite resource or are from or to the supplied environment.
func RenderFromJSON ¶ added in v1.14.0
RenderFromJSON renders the supplied resource from JSON bytes.
func RenderToCompositePatches ¶ added in v1.14.0
RenderToCompositePatches renders the supplied composite resource by applying all patches that are _from_ the supplied composed resource. composed resource and template.
func ResolveConvert ¶ added in v1.11.0
func ResolveConvert(t v1.ConvertTransform, input any) (any, error)
ResolveConvert resolves a Convert transform by looking up the appropriate conversion function for the given input type and invoking it.
func ResolveLabelValue ¶ added in v1.14.0
func ResolveLabelValue(m v1.EnvironmentSourceSelectorLabelMatcher, cp runtime.Object) (string, error)
ResolveLabelValue from a EnvironmentSourceSelectorLabelMatcher and an Object.
func ResolveMap ¶ added in v1.11.0
func ResolveMap(t v1.MapTransform, input any) (any, error)
ResolveMap resolves a Map transform.
func ResolveMatch ¶ added in v1.11.0
func ResolveMatch(t v1.MatchTransform, input any) (any, error)
ResolveMatch resolves a Match transform.
func ResolveMath ¶ added in v1.11.0
func ResolveMath(t v1.MathTransform, input any) (any, error)
ResolveMath resolves a Math transform.
func ResolveString ¶ added in v1.11.0
func ResolveString(t v1.StringTransform, input any) (string, error)
ResolveString resolves a String transform.
func ResolveTransforms ¶ added in v1.11.0
ResolveTransforms applies a list of transforms to a patch value.
func SetCompositionResourceName ¶ added in v1.1.0
func SetCompositionResourceName(o metav1.Object, n ResourceName)
SetCompositionResourceName sets the name of the composition template used to reconcile a composed resource as an annotation.
func UpdateResourceRefs ¶ added in v1.11.0
func UpdateResourceRefs(xr resource.ComposedResourcesReferencer, desired ComposedResourceStates)
UpdateResourceRefs updates the supplied state to ensure the XR references all composed resources that exist or are pending creation.
Types ¶
type APIConfigurator ¶
type APIConfigurator struct {
// contains filtered or unexported fields
}
An APIConfigurator configures a composite resource using its composition.
func NewAPIConfigurator ¶
func NewAPIConfigurator(c client.Client) *APIConfigurator
NewAPIConfigurator returns a Configurator that configures a composite resource using its composition.
func (*APIConfigurator) Configure ¶
func (c *APIConfigurator) Configure(ctx context.Context, cp resource.Composite, rev *v1.CompositionRevision) error
Configure any required fields that were omitted from the composite resource by copying them from its composition.
type APIDefaultCompositionSelector ¶
type APIDefaultCompositionSelector struct {
// contains filtered or unexported fields
}
APIDefaultCompositionSelector selects the default composition referenced in the definition of the resource if neither a reference nor selector is given in composite resource.
func NewAPIDefaultCompositionSelector ¶
func NewAPIDefaultCompositionSelector(c client.Client, ref corev1.ObjectReference, r event.Recorder) *APIDefaultCompositionSelector
NewAPIDefaultCompositionSelector returns a APIDefaultCompositionSelector.
func (*APIDefaultCompositionSelector) SelectComposition ¶
func (s *APIDefaultCompositionSelector) SelectComposition(ctx context.Context, cp resource.Composite) error
SelectComposition selects the default compositionif neither a reference nor selector is given in composite resource.
type APIEnvironmentFetcher ¶ added in v1.14.0
type APIEnvironmentFetcher struct {
// contains filtered or unexported fields
}
APIEnvironmentFetcher fetches the Environments referenced by a composite resoruce using a kube client.
func NewAPIEnvironmentFetcher ¶ added in v1.14.0
func NewAPIEnvironmentFetcher(kube client.Client) *APIEnvironmentFetcher
NewAPIEnvironmentFetcher creates a new APIEnvironmentFetcher
func (*APIEnvironmentFetcher) Fetch ¶ added in v1.14.0
func (f *APIEnvironmentFetcher) Fetch(ctx context.Context, req EnvironmentFetcherRequest) (*Environment, error)
Fetch all EnvironmentConfigs referenced by cr and merge their `.Data` into a single Environment.
Note: The `.Data` path is trimmed from the result so its necessary to include it in patches.
type APIEnvironmentSelector ¶ added in v1.14.0
type APIEnvironmentSelector struct {
// contains filtered or unexported fields
}
APIEnvironmentSelector selects an environment using a kube client.
func NewAPIEnvironmentSelector ¶ added in v1.14.0
func NewAPIEnvironmentSelector(kube client.Client) *APIEnvironmentSelector
NewAPIEnvironmentSelector creates a new APIEnvironmentSelector
func (*APIEnvironmentSelector) SelectEnvironment ¶ added in v1.14.0
func (s *APIEnvironmentSelector) SelectEnvironment(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
SelectEnvironment for cr using the configuration defined in comp. The computed list of EnvironmentConfig references will be stored in cr.
type APIFilteredSecretPublisher ¶
type APIFilteredSecretPublisher struct {
// contains filtered or unexported fields
}
APIFilteredSecretPublisher publishes ConnectionDetails content after filtering it through a set of permitted keys.
func NewAPIFilteredSecretPublisher ¶
func NewAPIFilteredSecretPublisher(c client.Client, filter []string) *APIFilteredSecretPublisher
NewAPIFilteredSecretPublisher returns a ConnectionPublisher that only publishes connection secret keys that are included in the supplied filter.
func (*APIFilteredSecretPublisher) PublishConnection ¶
func (a *APIFilteredSecretPublisher) PublishConnection(ctx context.Context, o resource.ConnectionSecretOwner, c managed.ConnectionDetails) (bool, error)
PublishConnection publishes the supplied ConnectionDetails to the Secret referenced in the resource.
func (*APIFilteredSecretPublisher) UnpublishConnection ¶
func (a *APIFilteredSecretPublisher) UnpublishConnection(_ context.Context, _ resource.ConnectionSecretOwner, _ managed.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 APILabelSelectorResolver ¶
type APILabelSelectorResolver struct {
// contains filtered or unexported fields
}
APILabelSelectorResolver is used to resolve the composition selector on the instance to composition reference.
func NewAPILabelSelectorResolver ¶
func NewAPILabelSelectorResolver(c client.Client) *APILabelSelectorResolver
NewAPILabelSelectorResolver returns a SelectorResolver for composite resource.
func (*APILabelSelectorResolver) SelectComposition ¶
func (r *APILabelSelectorResolver) SelectComposition(ctx context.Context, cp resource.Composite) error
SelectComposition resolves selector to a reference if it doesn't exist.
type APINamingConfigurator ¶
type APINamingConfigurator struct {
// contains filtered or unexported fields
}
An APINamingConfigurator sets the root name prefix to its own name if it is not already set.
func NewAPINamingConfigurator ¶
func NewAPINamingConfigurator(c client.Client) *APINamingConfigurator
NewAPINamingConfigurator returns a Configurator that sets the root name prefixKu to its own name if it is not already set.
func (*APINamingConfigurator) Configure ¶
func (c *APINamingConfigurator) Configure(ctx context.Context, cp resource.Composite, _ *v1.CompositionRevision) error
Configure the supplied composite resource's root name prefix.
type APIRevisionFetcher ¶ added in v1.4.0
type APIRevisionFetcher struct {
// contains filtered or unexported fields
}
An APIRevisionFetcher selects the appropriate CompositionRevision for a composite resource, fetches it, and returns it as a Composition. This is done for compatibility with existing Composition logic while CompositionRevisions are in alpha.
func NewAPIRevisionFetcher ¶ added in v1.4.0
func NewAPIRevisionFetcher(ca resource.ClientApplicator) *APIRevisionFetcher
NewAPIRevisionFetcher returns a RevisionFetcher that fetches the Revision referenced by a composite resource.
func (*APIRevisionFetcher) Fetch ¶ added in v1.4.0
func (f *APIRevisionFetcher) Fetch(ctx context.Context, cr resource.Composite) (*v1.CompositionRevision, error)
Fetch the appropriate CompositionRevision for the supplied XR. Panics if the composite resource's composition reference is nil, but handles setting the composition revision reference.
type ComposedResource ¶ added in v1.11.0
type ComposedResource struct { // ResourceName of the composed resource. ResourceName ResourceName // Ready indicates whether this composed resource is ready - i.e. whether // all of its readiness checks passed. Ready bool }
A ComposedResource is an output of the composition process.
type ComposedResourceGarbageCollector ¶ added in v1.14.0
type ComposedResourceGarbageCollector interface {
GarbageCollectComposedResources(ctx context.Context, owner metav1.Object, observed, desired ComposedResourceStates) error
}
A ComposedResourceGarbageCollector deletes observed composed resources that are no longer desired.
type ComposedResourceGarbageCollectorFn ¶ added in v1.14.0
type ComposedResourceGarbageCollectorFn func(ctx context.Context, owner metav1.Object, observed, desired ComposedResourceStates) error
A ComposedResourceGarbageCollectorFn deletes observed composed resources that are no longer desired.
func (ComposedResourceGarbageCollectorFn) GarbageCollectComposedResources ¶ added in v1.14.0
func (fn ComposedResourceGarbageCollectorFn) GarbageCollectComposedResources(ctx context.Context, owner metav1.Object, observed, desired ComposedResourceStates) error
GarbageCollectComposedResources deletes observed composed resources that are no longer desired.
type ComposedResourceObserver ¶ added in v1.11.0
type ComposedResourceObserver interface {
ObserveComposedResources(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
}
A ComposedResourceObserver observes existing composed resources.
type ComposedResourceObserverFn ¶ added in v1.11.0
type ComposedResourceObserverFn func(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
A ComposedResourceObserverFn observes existing composed resources.
func (ComposedResourceObserverFn) ObserveComposedResources ¶ added in v1.11.0
func (fn ComposedResourceObserverFn) ObserveComposedResources(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
ObserveComposedResources observes existing composed resources.
type ComposedResourceState ¶ added in v1.11.0
type ComposedResourceState struct { Resource resource.Composed ConnectionDetails managed.ConnectionDetails Ready bool }
ComposedResourceState represents a composed resource (either desired or observed).
type ComposedResourceStates ¶ added in v1.11.0
type ComposedResourceStates map[ResourceName]ComposedResourceState
ComposedResourceStates tracks the state of composed resources.
type ComposedResourceTemplates ¶ added in v1.14.0
type ComposedResourceTemplates map[ResourceName]v1.ComposedTemplate
ComposedResourceTemplates are the P&T templates for composed resources.
type Composer ¶ added in v1.11.0
type Composer interface {
Compose(ctx context.Context, xr *composite.Unstructured, req CompositionRequest) (CompositionResult, error)
}
A Composer composes (i.e. creates, updates, or deletes) resources given the supplied composite resource and composition request.
type ComposerFn ¶ added in v1.11.0
type ComposerFn func(ctx context.Context, xr *composite.Unstructured, req CompositionRequest) (CompositionResult, error)
A ComposerFn composes resources.
func (ComposerFn) Compose ¶ added in v1.11.0
func (fn ComposerFn) Compose(ctx context.Context, xr *composite.Unstructured, req CompositionRequest) (CompositionResult, error)
Compose resources.
type ComposerSelectorFn ¶ added in v1.14.0
type ComposerSelectorFn func(*v1.CompositionMode) Composer
A ComposerSelectorFn selects the appropriate Composer for a mode.
func (ComposerSelectorFn) Compose ¶ added in v1.14.0
func (fn ComposerSelectorFn) Compose(ctx context.Context, xr *composite.Unstructured, req CompositionRequest) (CompositionResult, error)
Compose calls the Composer returned by calling fn.
type CompositionRequest ¶ added in v1.11.0
type CompositionRequest struct { Revision *v1.CompositionRevision Environment *Environment }
A CompositionRequest is a request to compose resources. It should be treated as immutable.
type CompositionResult ¶ added in v1.11.0
type CompositionResult struct { Composed []ComposedResource ConnectionDetails managed.ConnectionDetails Events []event.Event }
A CompositionResult is the result of the composition process.
type CompositionRevisionFetcher ¶ added in v1.12.0
type CompositionRevisionFetcher interface {
Fetch(ctx context.Context, cr resource.Composite) (*v1.CompositionRevision, error)
}
A CompositionRevisionFetcher fetches an appropriate Composition for the supplied composite resource.
type CompositionRevisionFetcherFn ¶ added in v1.12.0
type CompositionRevisionFetcherFn func(ctx context.Context, cr resource.Composite) (*v1.CompositionRevision, error)
A CompositionRevisionFetcherFn fetches an appropriate CompositionRevision for the supplied composite resource.
func (CompositionRevisionFetcherFn) Fetch ¶ added in v1.12.0
func (fn CompositionRevisionFetcherFn) Fetch(ctx context.Context, cr resource.Composite) (*v1.CompositionRevision, error)
Fetch an appropriate Composition for the supplied Composite resource.
type CompositionRevisionValidator ¶ added in v1.12.0
type CompositionRevisionValidator interface {
Validate(*v1.CompositionRevision) error
}
A CompositionRevisionValidator validates the supplied CompositionRevision.
type CompositionRevisionValidatorFn ¶ added in v1.12.0
type CompositionRevisionValidatorFn func(*v1.CompositionRevision) error
A CompositionRevisionValidatorFn is a function that validates a CompositionRevision.
func (CompositionRevisionValidatorFn) Validate ¶ added in v1.12.0
func (fn CompositionRevisionValidatorFn) Validate(c *v1.CompositionRevision) error
Validate the supplied CompositionRevision.
type CompositionSelector ¶
type CompositionSelector interface {
SelectComposition(ctx context.Context, cr resource.Composite) error
}
A CompositionSelector selects a composition reference.
type CompositionSelectorChain ¶
type CompositionSelectorChain struct {
// contains filtered or unexported fields
}
CompositionSelectorChain calls the given list of CompositionSelectors in order.
func NewCompositionSelectorChain ¶
func NewCompositionSelectorChain(list ...CompositionSelector) *CompositionSelectorChain
NewCompositionSelectorChain returns a new CompositionSelectorChain.
func (*CompositionSelectorChain) SelectComposition ¶
func (r *CompositionSelectorChain) SelectComposition(ctx context.Context, cp resource.Composite) error
SelectComposition calls all SelectComposition functions of CompositionSelectors in the list.
type CompositionSelectorFn ¶
A CompositionSelectorFn selects a composition reference.
func (CompositionSelectorFn) SelectComposition ¶
SelectComposition for the supplied composite resource.
type CompositionTemplateAssociator ¶ added in v1.1.0
type CompositionTemplateAssociator interface {
AssociateTemplates(context.Context, resource.Composite, []v1.ComposedTemplate) ([]TemplateAssociation, error)
}
A CompositionTemplateAssociator returns an array of template associations.
type CompositionTemplateAssociatorFn ¶ added in v1.1.0
type CompositionTemplateAssociatorFn func(context.Context, resource.Composite, []v1.ComposedTemplate) ([]TemplateAssociation, error)
A CompositionTemplateAssociatorFn returns an array of template associations.
func (CompositionTemplateAssociatorFn) AssociateTemplates ¶ added in v1.1.0
func (fn CompositionTemplateAssociatorFn) AssociateTemplates(ctx context.Context, cr resource.Composite, ct []v1.ComposedTemplate) ([]TemplateAssociation, error)
AssociateTemplates with composed resources.
type ConditionedObject ¶ added in v1.11.0
type ConditionedObject interface { resource.Object resource.Conditioned }
A ConditionedObject is a runtime object with conditions.
type Configurator ¶
type Configurator interface {
Configure(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
}
A Configurator configures a composite resource using its composition.
type ConfiguratorChain ¶
type ConfiguratorChain struct {
// contains filtered or unexported fields
}
ConfiguratorChain executes the Configurators in given order.
func NewConfiguratorChain ¶
func NewConfiguratorChain(l ...Configurator) *ConfiguratorChain
NewConfiguratorChain returns a new *ConfiguratorChain.
func (*ConfiguratorChain) Configure ¶
func (cc *ConfiguratorChain) Configure(ctx context.Context, cp resource.Composite, rev *v1.CompositionRevision) error
Configure calls Configure function of every Configurator in the list.
type ConfiguratorFn ¶
type ConfiguratorFn func(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
A ConfiguratorFn configures a composite resource using its composition.
func (ConfiguratorFn) Configure ¶
func (fn ConfiguratorFn) Configure(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
Configure the supplied composite resource using its composition.
type ConnectionDetailExtractConfig ¶ added in v1.11.0
type ConnectionDetailExtractConfig struct { // Type sets the connection detail fetching behaviour to be used. Each // connection detail type may require its own fields to be set on the // ConnectionDetail object. Type ConnectionDetailType // Name of the connection secret key that will be propagated to the // connection secret of the composition instance. Name string // FromConnectionDetailKey is the key that will be used to fetch the value // from the given target resource's connection details. FromConnectionSecretKey *string // FromFieldPath is the path of the field on the composed resource whose // value to be used as input. Name must be specified if the type is // FromFieldPath is specified. FromFieldPath *string // Value that will be propagated to the connection secret of the composition // instance. Typically you should use FromConnectionSecretKey instead, but // an explicit value may be set to inject a fixed, non-sensitive connection // secret values, for example a well-known port. Value *string }
A ConnectionDetailExtractConfig configures how an XR connection detail should be extracted.
func ExtractConfigsFromComposedTemplate ¶ added in v1.14.0
func ExtractConfigsFromComposedTemplate(t *v1.ComposedTemplate) []ConnectionDetailExtractConfig
ExtractConfigsFromComposedTemplate builds extract configs for the supplied P&T style composed resource template.
type ConnectionDetailType ¶ added in v1.11.0
type ConnectionDetailType string
A ConnectionDetailType is a type of connection detail.
const ( ConnectionDetailTypeFromConnectionSecretKey ConnectionDetailType = "FromConnectionSecretKey" ConnectionDetailTypeFromFieldPath ConnectionDetailType = "FromFieldPath" ConnectionDetailTypeFromValue ConnectionDetailType = "FromValue" )
ConnectionDetailType types.
type ConnectionDetailsExtractor ¶ added in v1.11.0
type ConnectionDetailsExtractor interface { // ExtractConnection of the supplied resource. ExtractConnection(cd resource.Composed, conn managed.ConnectionDetails, cfg ...ConnectionDetailExtractConfig) (managed.ConnectionDetails, error) }
ConnectionDetailsExtractor extracts the connection details of a resource.
type ConnectionDetailsExtractorFn ¶ added in v1.11.0
type ConnectionDetailsExtractorFn func(cd resource.Composed, conn managed.ConnectionDetails, cfg ...ConnectionDetailExtractConfig) (managed.ConnectionDetails, error)
A ConnectionDetailsExtractorFn is a function that satisfies ConnectionDetailsExtractor.
func (ConnectionDetailsExtractorFn) ExtractConnection ¶ added in v1.11.0
func (fn ConnectionDetailsExtractorFn) ExtractConnection(cd resource.Composed, conn managed.ConnectionDetails, cfg ...ConnectionDetailExtractConfig) (managed.ConnectionDetails, error)
ExtractConnection of the supplied resource.
type ConnectionDetailsFetcherChain ¶ added in v1.7.0
type ConnectionDetailsFetcherChain []managed.ConnectionDetailsFetcher
A ConnectionDetailsFetcherChain chains multiple ConnectionDetailsFetchers.
func (ConnectionDetailsFetcherChain) FetchConnection ¶ added in v1.11.0
func (fc ConnectionDetailsFetcherChain) FetchConnection(ctx context.Context, o resource.ConnectionSecretOwner) (managed.ConnectionDetails, error)
FetchConnection details of the supplied composed resource, if any.
type ConnectionDetailsFetcherFn ¶
type ConnectionDetailsFetcherFn func(ctx context.Context, o resource.ConnectionSecretOwner) (managed.ConnectionDetails, error)
A ConnectionDetailsFetcherFn fetches the connection details of the supplied resource, if any.
func (ConnectionDetailsFetcherFn) FetchConnection ¶ added in v1.11.0
func (f ConnectionDetailsFetcherFn) FetchConnection(ctx context.Context, o resource.ConnectionSecretOwner) (managed.ConnectionDetails, error)
FetchConnection calls the FetchConnectionDetailsFn.
type ConnectionSecretFilterer ¶
type ConnectionSecretFilterer interface {
GetConnectionSecretKeys() []string
}
ConnectionSecretFilterer returns a set of allowed keys.
type DeletingComposedResourceGarbageCollector ¶ added in v1.14.0
type DeletingComposedResourceGarbageCollector struct {
// contains filtered or unexported fields
}
An DeletingComposedResourceGarbageCollector deletes undesired composed resources from the API server.
func NewDeletingComposedResourceGarbageCollector ¶ added in v1.14.0
func NewDeletingComposedResourceGarbageCollector(c client.Writer) *DeletingComposedResourceGarbageCollector
NewDeletingComposedResourceGarbageCollector returns a ComposedResourceDeleter that deletes undesired composed resources from the API server.
func (*DeletingComposedResourceGarbageCollector) GarbageCollectComposedResources ¶ added in v1.14.0
func (d *DeletingComposedResourceGarbageCollector) GarbageCollectComposedResources(ctx context.Context, owner metav1.Object, observed, desired ComposedResourceStates) error
GarbageCollectComposedResources deletes any composed resource that didn't come out the other end of the Composition Function pipeline (i.e. that wasn't in the final desired state after running the pipeline) from the API server.
type EnforcedCompositionSelector ¶
type EnforcedCompositionSelector struct {
// contains filtered or unexported fields
}
EnforcedCompositionSelector , if it's given, selects the enforced composition on the definition for all composite instances.
func NewEnforcedCompositionSelector ¶
func NewEnforcedCompositionSelector(def v1.CompositeResourceDefinition, r event.Recorder) *EnforcedCompositionSelector
NewEnforcedCompositionSelector returns a EnforcedCompositionSelector.
func (*EnforcedCompositionSelector) SelectComposition ¶
func (s *EnforcedCompositionSelector) SelectComposition(_ context.Context, cp resource.Composite) error
SelectComposition selects the enforced composition if it's given in definition.
type Environment ¶ added in v1.14.0
type Environment struct {
unstructured.Unstructured
}
Environment defines unstructured data.
type EnvironmentFetcher ¶ added in v1.11.0
type EnvironmentFetcher interface {
Fetch(ctx context.Context, req EnvironmentFetcherRequest) (*Environment, error)
}
An EnvironmentFetcher fetches an appropriate environment for the supplied composite resource.
type EnvironmentFetcherFn ¶ added in v1.11.0
type EnvironmentFetcherFn func(ctx context.Context, req EnvironmentFetcherRequest) (*Environment, error)
An EnvironmentFetcherFn fetches an appropriate environment for the supplied composite resource.
func (EnvironmentFetcherFn) Fetch ¶ added in v1.11.0
func (fn EnvironmentFetcherFn) Fetch(ctx context.Context, req EnvironmentFetcherRequest) (*Environment, error)
Fetch an appropriate environment for the supplied Composite resource.
type EnvironmentFetcherRequest ¶ added in v1.14.0
type EnvironmentFetcherRequest struct { Composite resource.Composite Revision *v1.CompositionRevision Required bool }
EnvironmentFetcherRequest describes the payload for an EnvironmentFetcher.
type EnvironmentSelector ¶ added in v1.11.0
type EnvironmentSelector interface {
SelectEnvironment(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
}
EnvironmentSelector selects environment references for a composition environment.
type EnvironmentSelectorFn ¶ added in v1.11.0
type EnvironmentSelectorFn func(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
A EnvironmentSelectorFn selects a composition reference.
func (EnvironmentSelectorFn) SelectEnvironment ¶ added in v1.11.0
func (fn EnvironmentSelectorFn) SelectEnvironment(ctx context.Context, cr resource.Composite, rev *v1.CompositionRevision) error
SelectEnvironment for the supplied composite resource.
type ExistingComposedResourceObserver ¶ added in v1.14.0
type ExistingComposedResourceObserver struct {
// contains filtered or unexported fields
}
An ExistingComposedResourceObserver uses an XR's resource references to load any existing composed resources from the API server. It also loads their connection details.
func NewExistingComposedResourceObserver ¶ added in v1.14.0
func NewExistingComposedResourceObserver(c client.Reader, f managed.ConnectionDetailsFetcher) *ExistingComposedResourceObserver
NewExistingComposedResourceObserver returns a ComposedResourceGetter that fetches an XR's existing composed resources.
func (*ExistingComposedResourceObserver) ObserveComposedResources ¶ added in v1.14.0
func (g *ExistingComposedResourceObserver) ObserveComposedResources(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
ObserveComposedResources begins building composed resource state by fetching any existing composed resources referenced by the supplied composite resource, as well as their connection details.
type ExistingExtraResourcesFetcher ¶ added in v1.15.0
type ExistingExtraResourcesFetcher struct {
// contains filtered or unexported fields
}
ExistingExtraResourcesFetcher fetches extra resources requested by functions using the provided client.Reader.
func NewExistingExtraResourcesFetcher ¶ added in v1.15.0
func NewExistingExtraResourcesFetcher(c client.Reader) *ExistingExtraResourcesFetcher
NewExistingExtraResourcesFetcher returns a new ExistingExtraResourcesFetcher.
func (*ExistingExtraResourcesFetcher) Fetch ¶ added in v1.15.0
func (e *ExistingExtraResourcesFetcher) Fetch(ctx context.Context, rs *v1beta1.ResourceSelector) (*v1beta1.Resources, error)
Fetch fetches resources requested by functions using the provided client.Reader.
type ExtraResourcesFetcher ¶ added in v1.15.0
type ExtraResourcesFetcher interface {
Fetch(ctx context.Context, rs *v1beta1.ResourceSelector) (*v1beta1.Resources, error)
}
A ExtraResourcesFetcher gets extra resources matching a selector.
type ExtraResourcesFetcherFn ¶ added in v1.15.0
type ExtraResourcesFetcherFn func(ctx context.Context, rs *v1beta1.ResourceSelector) (*v1beta1.Resources, error)
An ExtraResourcesFetcherFn gets extra resources matching the selector.
func (ExtraResourcesFetcherFn) Fetch ¶ added in v1.15.0
func (fn ExtraResourcesFetcherFn) Fetch(ctx context.Context, rs *v1beta1.ResourceSelector) (*v1beta1.Resources, error)
Fetch gets extra resources matching the selector.
type FunctionComposer ¶ added in v1.14.0
type FunctionComposer struct {
// contains filtered or unexported fields
}
A FunctionComposer supports composing resources using a pipeline of Composition Functions. It ignores the P&T resources array.
func NewFunctionComposer ¶ added in v1.14.0
func NewFunctionComposer(kube client.Client, r FunctionRunner, o ...FunctionComposerOption) *FunctionComposer
NewFunctionComposer returns a new Composer that supports composing resources using both Patch and Transform (P&T) logic and a pipeline of Composition Functions.
func (*FunctionComposer) Compose ¶ added in v1.14.0
func (c *FunctionComposer) Compose(ctx context.Context, xr *composite.Unstructured, req CompositionRequest) (CompositionResult, error)
Compose resources using the Functions pipeline.
type FunctionComposerOption ¶ added in v1.14.0
type FunctionComposerOption func(*FunctionComposer)
A FunctionComposerOption is used to configure a FunctionComposer.
func WithComposedResourceGarbageCollector ¶ added in v1.14.0
func WithComposedResourceGarbageCollector(d ComposedResourceGarbageCollector) FunctionComposerOption
WithComposedResourceGarbageCollector configures how the FunctionComposer should garbage collect undesired composed resources.
func WithComposedResourceObserver ¶ added in v1.11.0
func WithComposedResourceObserver(g ComposedResourceObserver) FunctionComposerOption
WithComposedResourceObserver configures how the FunctionComposer should get existing composed resources.
func WithCompositeConnectionDetailsFetcher ¶ added in v1.11.0
func WithCompositeConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) FunctionComposerOption
WithCompositeConnectionDetailsFetcher configures how the FunctionComposer should get the composite resource's connection details.
func WithExtraResourcesFetcher ¶ added in v1.15.0
func WithExtraResourcesFetcher(f ExtraResourcesFetcher) FunctionComposerOption
WithExtraResourcesFetcher configures how the FunctionComposer should fetch extra resources requested by functions.
type FunctionRunner ¶ added in v1.14.0
type FunctionRunner interface { // RunFunction runs the named Composition Function. RunFunction(ctx context.Context, name string, req *v1beta1.RunFunctionRequest) (*v1beta1.RunFunctionResponse, error) }
A FunctionRunner runs a single Composition Function.
type FunctionRunnerFn ¶ added in v1.14.0
type FunctionRunnerFn func(ctx context.Context, name string, req *v1beta1.RunFunctionRequest) (*v1beta1.RunFunctionResponse, error)
A FunctionRunnerFn is a function that can run a Composition Function.
func (FunctionRunnerFn) RunFunction ¶ added in v1.14.0
func (fn FunctionRunnerFn) RunFunction(ctx context.Context, name string, req *v1beta1.RunFunctionRequest) (*v1beta1.RunFunctionResponse, error)
RunFunction runs the named Composition Function with the supplied request.
type GarbageCollectingAssociator ¶ added in v1.1.0
type GarbageCollectingAssociator struct {
// contains filtered or unexported fields
}
A GarbageCollectingAssociator associates a Composition's resource templates with (references to) composed resources. It tries to associate them by checking the template name annotation of each referenced resource. If any template or existing composed resource can't be associated by name it falls back to associating them by order. If it encounters a referenced resource that corresponds to a non-existent template the resource will be garbage collected (i.e. deleted).
func NewGarbageCollectingAssociator ¶ added in v1.1.0
func NewGarbageCollectingAssociator(c client.Client) *GarbageCollectingAssociator
NewGarbageCollectingAssociator returns a CompositionTemplateAssociator that may garbage collect composed resources.
func (*GarbageCollectingAssociator) AssociateTemplates ¶ added in v1.1.0
func (a *GarbageCollectingAssociator) AssociateTemplates(ctx context.Context, cr resource.Composite, ct []v1.ComposedTemplate) ([]TemplateAssociation, error)
AssociateTemplates with composed resources.
type KindObserver ¶ added in v1.14.0
type KindObserver interface { // WatchComposedResources starts a watch of the given kinds to trigger reconciles when // a referenced object of those kinds changes. WatchComposedResources(kind ...schema.GroupVersionKind) }
KindObserver tracks kinds of referenced composed resources in composite resources in order to start watches for them for realtime events.
type KindObserverFunc ¶ added in v1.14.0
type KindObserverFunc func(kind ...schema.GroupVersionKind)
KindObserverFunc implements KindObserver as a function.
func (KindObserverFunc) WatchComposedResources ¶ added in v1.14.0
func (fn KindObserverFunc) WatchComposedResources(kind ...schema.GroupVersionKind)
WatchComposedResources starts a watch of the given kinds to trigger reconciles when a referenced object of those kinds changes.
type MatchConditionReadinessCheck ¶ added in v1.13.0
type MatchConditionReadinessCheck struct { // Type indicates the type of condition you'd like to use. Type xpv1.ConditionType // Status is the status of the condition you'd like to match. Status corev1.ConditionStatus }
MatchConditionReadinessCheck is used to indicate how to tell whether a resource is ready for consumption
type NilEnvironmentFetcher ¶ added in v1.14.0
type NilEnvironmentFetcher struct{}
A NilEnvironmentFetcher always returns nil on Fetch().
func NewNilEnvironmentFetcher ¶ added in v1.14.0
func NewNilEnvironmentFetcher() *NilEnvironmentFetcher
NewNilEnvironmentFetcher creates a new NilEnvironmentFetcher.
func (*NilEnvironmentFetcher) Fetch ¶ added in v1.14.0
func (f *NilEnvironmentFetcher) Fetch(_ context.Context, _ EnvironmentFetcherRequest) (*Environment, error)
Fetch always returns nil.
type NoopEnvironmentSelector ¶ added in v1.14.0
type NoopEnvironmentSelector struct{}
A NoopEnvironmentSelector always returns nil on Fetch().
func NewNoopEnvironmentSelector ¶ added in v1.14.0
func NewNoopEnvironmentSelector() *NoopEnvironmentSelector
NewNoopEnvironmentSelector creates a new NoopEnvironmentSelector.
func (*NoopEnvironmentSelector) SelectEnvironment ¶ added in v1.14.0
func (s *NoopEnvironmentSelector) SelectEnvironment(_ context.Context, _ resource.Composite, _ *v1.CompositionRevision) error
SelectEnvironment always returns nil.
type Observation ¶
type Observation struct { Ref corev1.ObjectReference ConnectionDetails managed.ConnectionDetails Ready bool }
Observation is the result of composed reconciliation.
type PTComposer ¶ added in v1.11.0
type PTComposer struct {
// contains filtered or unexported fields
}
A PTComposer composes resources using Patch and Transform (P&T) Composition. It uses a Composition's 'resources' array, which consist of 'base' resources along with a series of patches and transforms. It does not support Functions - any entries in the functions array are ignored.
func NewPTComposer ¶ added in v1.11.0
func NewPTComposer(kube client.Client, o ...PTComposerOption) *PTComposer
NewPTComposer returns a Composer that composes resources using Patch and Transform (P&T) Composition - a Composition's bases, patches, and transforms.
func (*PTComposer) Compose ¶ added in v1.11.0
func (c *PTComposer) Compose(ctx context.Context, xr *composite.Unstructured, req CompositionRequest) (CompositionResult, error)
Compose resources using the bases, patches, and transforms specified by the supplied Composition. This reconciler supports only Patch & Transform Composition (not the Function pipeline). It does this in roughly four steps:
- Figure out which templates are associated with which existing composed resources, if any.
- Render from those templates into new or existing composed resources.
- Apply all composed resources that rendered successfully.
- Observe the readiness and connection details of all composed resources that rendered successfully.
type PTComposerOption ¶ added in v1.11.0
type PTComposerOption func(*PTComposer)
A PTComposerOption is used to configure a PTComposer.
func WithComposedConnectionDetailsExtractor ¶ added in v1.11.0
func WithComposedConnectionDetailsExtractor(e ConnectionDetailsExtractor) PTComposerOption
WithComposedConnectionDetailsExtractor configures how a PatchAndTransformComposer extracts XR connection details from a composed resource.
func WithComposedConnectionDetailsFetcher ¶ added in v1.11.0
func WithComposedConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) PTComposerOption
WithComposedConnectionDetailsFetcher configures how a PatchAndTransformComposer fetches composed resource connection details.
func WithComposedNameGenerator ¶ added in v1.14.0
func WithComposedNameGenerator(r names.NameGenerator) PTComposerOption
WithComposedNameGenerator configures how the PTComposer should generate names for unnamed composed resources.
func WithComposedReadinessChecker ¶ added in v1.11.0
func WithComposedReadinessChecker(r ReadinessChecker) PTComposerOption
WithComposedReadinessChecker configures how a PatchAndTransformComposer checks composed resource readiness.
func WithTemplateAssociator ¶ added in v1.11.0
func WithTemplateAssociator(a CompositionTemplateAssociator) PTComposerOption
WithTemplateAssociator configures how a PatchAndTransformComposer associates templates with extant composed resources.
type ReadinessCheck ¶ added in v1.11.0
type ReadinessCheck struct { // Type indicates the type of probe you'd like to use. Type ReadinessCheckType // FieldPath shows the path of the field whose value will be used. FieldPath *string // MatchString is the value you'd like to match if you're using "MatchString" type. MatchString *string // MatchInt is the value you'd like to match if you're using "MatchInt" type. MatchInteger *int64 // MatchCondition is the condition you'd like to match if you're using "MatchCondition" type. MatchCondition *MatchConditionReadinessCheck }
ReadinessCheck is used to indicate how to tell whether a resource is ready for consumption
func ReadinessCheckFromV1 ¶ added in v1.13.0
func ReadinessCheckFromV1(in *v1.ReadinessCheck) ReadinessCheck
ReadinessCheckFromV1 derives a ReadinessCheck from the supplied v1.ReadinessCheck.
func ReadinessChecksFromComposedTemplate ¶ added in v1.13.0
func ReadinessChecksFromComposedTemplate(t *v1.ComposedTemplate) []ReadinessCheck
ReadinessChecksFromComposedTemplate derives readiness checks from the supplied composed template.
func (ReadinessCheck) IsReady ¶ added in v1.11.0
func (c ReadinessCheck) IsReady(p *fieldpath.Paved, o ConditionedObject) (bool, error)
IsReady runs the readiness check against the supplied object.
func (ReadinessCheck) Validate ¶ added in v1.11.0
func (c ReadinessCheck) Validate() error
Validate returns an error if the readiness check is invalid.
type ReadinessCheckType ¶ added in v1.11.0
type ReadinessCheckType string
ReadinessCheckType is used for readiness check types.
const ( ReadinessCheckTypeNonEmpty ReadinessCheckType = "NonEmpty" ReadinessCheckTypeMatchString ReadinessCheckType = "MatchString" ReadinessCheckTypeMatchInteger ReadinessCheckType = "MatchInteger" // discussion regarding MatchBool vs MatchTrue/MatchFalse: // https://github.com/crossplane/crossplane/pull/4399#discussion_r1277225375 ReadinessCheckTypeMatchTrue ReadinessCheckType = "MatchTrue" ReadinessCheckTypeMatchFalse ReadinessCheckType = "MatchFalse" ReadinessCheckTypeMatchCondition ReadinessCheckType = "MatchCondition" ReadinessCheckTypeNone ReadinessCheckType = "None" )
The possible values for readiness check type.
type ReadinessChecker ¶
type ReadinessChecker interface {
IsReady(ctx context.Context, o ConditionedObject, rc ...ReadinessCheck) (ready bool, err error)
}
A ReadinessChecker checks whether a composed resource is ready or not.
type ReadinessCheckerFn ¶
type ReadinessCheckerFn func(ctx context.Context, o ConditionedObject, rc ...ReadinessCheck) (ready bool, err error)
A ReadinessCheckerFn checks whether a composed resource is ready or not.
func (ReadinessCheckerFn) IsReady ¶
func (fn ReadinessCheckerFn) IsReady(ctx context.Context, o ConditionedObject, rc ...ReadinessCheck) (ready bool, err error)
IsReady reports whether a composed resource is ready or not.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
A Reconciler reconciles composite resources.
func NewReconciler ¶
func NewReconciler(mgr manager.Manager, of resource.CompositeKind, opts ...ReconcilerOption) *Reconciler
NewReconciler returns a new Reconciler of composite resources.
type ReconcilerOption ¶
type ReconcilerOption func(*Reconciler)
ReconcilerOption is used to configure the Reconciler.
func WithClient ¶ added in v1.11.0
func WithClient(c client.Client) ReconcilerOption
WithClient specifies how the Reconciler should interact with the Kubernetes API.
func WithComposer ¶ added in v1.11.0
func WithComposer(c Composer) ReconcilerOption
WithComposer specifies how the Reconciler should compose resources.
func WithCompositeFinalizer ¶ added in v1.7.0
func WithCompositeFinalizer(f resource.Finalizer) ReconcilerOption
WithCompositeFinalizer specifies how the composition to be used should be selected. WithCompositeFinalizer specifies which Finalizer should be used to finalize composites when they are deleted.
func WithCompositionRevisionFetcher ¶ added in v1.12.0
func WithCompositionRevisionFetcher(f CompositionRevisionFetcher) ReconcilerOption
WithCompositionRevisionFetcher specifies how the composition to be used should be fetched.
func WithCompositionRevisionValidator ¶ added in v1.12.0
func WithCompositionRevisionValidator(v CompositionRevisionValidator) ReconcilerOption
WithCompositionRevisionValidator specifies how the Reconciler should validate CompositionRevisions.
func WithCompositionSelector ¶
func WithCompositionSelector(s CompositionSelector) ReconcilerOption
WithCompositionSelector specifies how the composition to be used should be selected.
func WithConfigurator ¶
func WithConfigurator(c Configurator) ReconcilerOption
WithConfigurator specifies how the Reconciler should configure composite resources using their composition.
func WithConnectionPublishers ¶ added in v1.7.0
func WithConnectionPublishers(p ...managed.ConnectionPublisher) ReconcilerOption
WithConnectionPublishers specifies how the Reconciler should publish connection secrets.
func WithEnvironmentFetcher ¶ added in v1.11.0
func WithEnvironmentFetcher(f EnvironmentFetcher) ReconcilerOption
WithEnvironmentFetcher specifies how the environment to be used should be fetched.
func WithEnvironmentSelector ¶ added in v1.11.0
func WithEnvironmentSelector(s EnvironmentSelector) ReconcilerOption
WithEnvironmentSelector specifies how the environment to be used should be selected.
func WithKindObserver ¶ added in v1.14.0
func WithKindObserver(o KindObserver) ReconcilerOption
WithKindObserver specifies how the Reconciler should observe kinds for realtime events.
func WithLogger ¶
func WithLogger(log logging.Logger) ReconcilerOption
WithLogger specifies how the Reconciler should log messages.
func WithPollInterval ¶ added in v1.6.0
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 Kubernetes events.
type ResourceName ¶ added in v1.14.0
type ResourceName string
A ResourceName uniquely identifies the composed resource within a Composition and within Composition Function gRPC calls. This is not the metadata.name of the actual composed resource instance; rather it is the name of an entry in a Composition's resources array, and/or a RunFunctionRequest's observed/desired resources object.
func GetCompositionResourceName ¶ added in v1.1.0
func GetCompositionResourceName(o metav1.Object) ResourceName
GetCompositionResourceName gets the name of the composition template used to reconcile a composed resource from its annotations.
type SecretConnectionDetailsFetcher ¶ added in v1.11.0
type SecretConnectionDetailsFetcher struct {
// contains filtered or unexported fields
}
An SecretConnectionDetailsFetcher may use the API server to read connection details from a Kubernetes Secret.
func NewSecretConnectionDetailsFetcher ¶ added in v1.11.0
func NewSecretConnectionDetailsFetcher(c client.Client) *SecretConnectionDetailsFetcher
NewSecretConnectionDetailsFetcher returns a ConnectionDetailsFetcher that may use the API server to read connection details from a Kubernetes Secret.
func (*SecretConnectionDetailsFetcher) FetchConnection ¶ added in v1.11.0
func (cdf *SecretConnectionDetailsFetcher) FetchConnection(ctx context.Context, o resource.ConnectionSecretOwner) (managed.ConnectionDetails, error)
FetchConnection details of the supplied composed resource from its Kubernetes connection secret, per its WriteConnectionSecretToRef, if any.
type SecretStoreConnectionDetailsConfigurator ¶ added in v1.7.0
type SecretStoreConnectionDetailsConfigurator struct {
// contains filtered or unexported fields
}
A SecretStoreConnectionDetailsConfigurator configures a composite resource using its composition.
func NewSecretStoreConnectionDetailsConfigurator ¶ added in v1.7.0
func NewSecretStoreConnectionDetailsConfigurator(c client.Client) *SecretStoreConnectionDetailsConfigurator
NewSecretStoreConnectionDetailsConfigurator returns a Configurator that configures a composite resource using its composition.
func (*SecretStoreConnectionDetailsConfigurator) Configure ¶ added in v1.7.0
func (c *SecretStoreConnectionDetailsConfigurator) Configure(ctx context.Context, cp resource.Composite, rev *v1.CompositionRevision) error
Configure any required fields that were omitted from the composite resource by copying them from its composition.
type SecretStoreConnectionPublisher ¶ added in v1.7.0
type SecretStoreConnectionPublisher struct {
// contains filtered or unexported fields
}
SecretStoreConnectionPublisher is a ConnectionPublisher that stores connection details on the configured SecretStore.
func NewSecretStoreConnectionPublisher ¶ added in v1.7.0
func NewSecretStoreConnectionPublisher(p managed.ConnectionPublisher, filter []string) *SecretStoreConnectionPublisher
NewSecretStoreConnectionPublisher returns a SecretStoreConnectionPublisher
func (*SecretStoreConnectionPublisher) PublishConnection ¶ added in v1.7.0
func (p *SecretStoreConnectionPublisher) PublishConnection(ctx context.Context, o resource.ConnectionSecretOwner, c managed.ConnectionDetails) (published bool, err error)
PublishConnection details for the supplied resource.
func (*SecretStoreConnectionPublisher) UnpublishConnection ¶ added in v1.7.0
func (p *SecretStoreConnectionPublisher) UnpublishConnection(ctx context.Context, o resource.ConnectionSecretOwner, c managed.ConnectionDetails) error
UnpublishConnection details for the supplied resource.
type TemplateAssociation ¶ added in v1.1.0
type TemplateAssociation struct { Template v1.ComposedTemplate Reference corev1.ObjectReference }
A TemplateAssociation associates a composed resource template with a composed resource. If no such resource exists the reference will be empty.
func AssociateByOrder ¶ added in v1.1.0
func AssociateByOrder(t []v1.ComposedTemplate, r []corev1.ObjectReference) []TemplateAssociation
AssociateByOrder associates the supplied templates with the supplied resource references by order; i.e. by assuming template n corresponds to reference n. The returned array will always be of the same length as the supplied array of templates. Any additional references will be truncated.