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 Combine(c v1.Combine, vars []any) (any, error)
- func CombineString(format string, vars []any) (any, error)
- func ComposedTemplates(pss []v1.PatchSet, cts []v1.ComposedTemplate) ([]v1.ComposedTemplate, error)
- func ControllerName(name string) string
- func ExtractConnectionDetails(cd resource.Composed, data managed.ConnectionDetails, ...) (managed.ConnectionDetails, error)
- func FunctionIODesired(s *PTFCompositionState) (iov1alpha1.Desired, error)
- func FunctionIOObserved(s *PTFCompositionState) (iov1alpha1.Observed, error)
- func GetCompositionResourceName(o metav1.Object) string
- func GetConversionFunc(t *v1.ConvertTransform, from v1.TransformIOType) (func(any) (any, error), error)
- func ImagePullConfig(fn *v1.ContainerFunction) *fnv1alpha1.ImagePullConfig
- 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 RenderComposite(_ context.Context, cp resource.Composite, cd resource.Composed, ...) error
- func Resolve(t v1.Transform, input any) (any, error)
- func ResolveConvert(t v1.ConvertTransform, input any) (any, 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 RunFunction(ctx context.Context, fnio *iov1alpha1.FunctionIO, fn *v1.ContainerFunction, ...) (*iov1alpha1.FunctionIO, error)
- func RunFunctionConfig(fn *v1.ContainerFunction) *fnv1alpha1.RunFunctionConfig
- func SetCompositionResourceName(o metav1.Object, name string)
- func UpdateResourceRefs(s *PTFCompositionState)
- type APIConfigurator
- type APIDefaultCompositionSelector
- type APIDefaultCompositionUpdatePolicySelector
- type APIDryRunRenderer
- type APIFilteredSecretPublisher
- type APILabelSelectorResolver
- type APINamingConfigurator
- type APIRevisionFetcher
- type ComposedResource
- type ComposedResourceDeleter
- type ComposedResourceDeleterFn
- type ComposedResourceGetter
- type ComposedResourceGetterFn
- type ComposedResourceObserver
- type ComposedResourceObserverChain
- type ComposedResourceObserverFn
- type ComposedResourceState
- type ComposedResourceStates
- type Composer
- type ComposerFn
- type CompositionRequest
- type CompositionResult
- type CompositionRevisionFetcher
- type CompositionRevisionFetcherFn
- type CompositionRevisionValidator
- type CompositionRevisionValidatorFn
- type CompositionSelector
- type CompositionSelectorChain
- type CompositionSelectorFn
- type CompositionTemplateAssociator
- type CompositionTemplateAssociatorFn
- type CompositionUpdatePolicySelector
- type CompositionUpdatePolicySelectorFn
- type ConditionedObject
- type Configurator
- type ConfiguratorChain
- type ConfiguratorFn
- type ConnectionDetailExtractConfig
- type ConnectionDetailType
- type ConnectionDetailsExtractor
- type ConnectionDetailsExtractorFn
- type ConnectionDetailsFetcherChain
- type ConnectionDetailsFetcherFn
- type ConnectionDetailsObserver
- type ConnectionSecretFilterer
- type ContainerFunctionRunner
- type ContainerFunctionRunnerFn
- type ContainerFunctionRunnerOption
- type EnforcedCompositionSelector
- type EnvironmentFetcher
- type EnvironmentFetcherFn
- type EnvironmentSelector
- type EnvironmentSelectorFn
- type ExistingComposedResourceGetter
- type FallBackComposer
- type FunctionPipeline
- type FunctionPipelineRunner
- type FunctionPipelineRunnerFn
- type GarbageCollectingAssociator
- type MatchConditionReadinessCheck
- type Observation
- type PTComposer
- type PTComposerOption
- func WithComposedConnectionDetailsExtractor(e ConnectionDetailsExtractor) PTComposerOption
- func WithComposedConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) PTComposerOption
- func WithComposedReadinessChecker(r ReadinessChecker) PTComposerOption
- func WithComposedRenderer(r Renderer) PTComposerOption
- func WithCompositeRenderer(r Renderer) PTComposerOption
- func WithTemplateAssociator(a CompositionTemplateAssociator) PTComposerOption
- type PTFComposer
- type PTFComposerOption
- func WithComposedResourceDeleter(d ComposedResourceDeleter) PTFComposerOption
- func WithComposedResourceGetter(g ComposedResourceGetter) PTFComposerOption
- func WithComposedResourceObserver(o ComposedResourceObserver) PTFComposerOption
- func WithCompositeConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) PTFComposerOption
- func WithFunctionPipelineRunner(r FunctionPipelineRunner) PTFComposerOption
- func WithPatchAndTransformer(pt PatchAndTransformer) PTFComposerOption
- type PTFCompositionState
- type PatchAndTransformer
- type PatchAndTransformerFn
- type ReadinessCheck
- func ReadinessCheckFromDesiredReadinessCheck(in *iov1alpha1.DesiredReadinessCheck) ReadinessCheck
- func ReadinessCheckFromV1(in *v1.ReadinessCheck) ReadinessCheck
- func ReadinessChecksFromComposedTemplate(t *v1.ComposedTemplate) []ReadinessCheck
- func ReadinessChecksFromDesiredResource(dr *iov1alpha1.DesiredResource) []ReadinessCheck
- type ReadinessCheckType
- type ReadinessChecker
- type ReadinessCheckerFn
- type ReadinessObserver
- 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 WithCompositionUpdatePolicySelector(s CompositionUpdatePolicySelector) ReconcilerOption
- func WithConfigurator(c Configurator) ReconcilerOption
- func WithConnectionPublishers(p ...managed.ConnectionPublisher) ReconcilerOption
- func WithEnvironmentFetcher(f EnvironmentFetcher) ReconcilerOption
- func WithEnvironmentSelector(s EnvironmentSelector) ReconcilerOption
- func WithLogger(log logging.Logger) ReconcilerOption
- func WithPollInterval(after time.Duration) ReconcilerOption
- func WithRecorder(er event.Recorder) ReconcilerOption
- type RenderFn
- type Renderer
- type RendererFn
- type SecretConnectionDetailsFetcher
- type SecretStoreConnectionDetailsConfigurator
- type SecretStoreConnectionPublisher
- type TemplateAssociation
- type TriggerFn
- type UndesiredComposedResourceDeleter
- type XRCDPatchAndTransformer
Constants ¶
const (
AnnotationKeyCompositionResourceName = "crossplane.io/composition-resource-name"
)
Annotation keys.
const DefaultTarget = "unix-abstract:crossplane/fn/default.sock"
DefaultTarget is the default function runner target endpoint.
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 CombineString ¶ added in v1.11.0
CombineString returns a single output by running a string format with all of its input variables.
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 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 FunctionIODesired ¶ added in v1.11.0
func FunctionIODesired(s *PTFCompositionState) (iov1alpha1.Desired, error)
FunctionIODesired builds the initial desired state for a FunctionIO from the XR and any existing or impending composed resources. This reflects the observed state of the world plus the initial desired state as built up by any P&T Composition that has taken place.
func FunctionIOObserved ¶ added in v1.11.0
func FunctionIOObserved(s *PTFCompositionState) (iov1alpha1.Observed, error)
FunctionIOObserved builds observed state for a FunctionIO from the XR and any existing composed resources. This reflects the observed state of the world before any Composition (P&T or function-based) has taken place.
func GetCompositionResourceName ¶ added in v1.1.0
GetCompositionResourceName gets the name of the composition template used to reconcile a composed resource from its annotations.
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 ImagePullConfig ¶ added in v1.11.0
func ImagePullConfig(fn *v1.ContainerFunction) *fnv1alpha1.ImagePullConfig
ImagePullConfig builds an ImagePullConfig for a FunctionIO.
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 RenderComposite ¶ added in v1.1.0
func RenderComposite(_ context.Context, cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate, _ *env.Environment) error
RenderComposite renders the supplied composite resource using the supplied 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 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 RunFunction ¶ added in v1.11.0
func RunFunction(ctx context.Context, fnio *iov1alpha1.FunctionIO, fn *v1.ContainerFunction, o ...ContainerFunctionRunnerOption) (*iov1alpha1.FunctionIO, error)
RunFunction calls an external container function runner via gRPC.
func RunFunctionConfig ¶ added in v1.11.0
func RunFunctionConfig(fn *v1.ContainerFunction) *fnv1alpha1.RunFunctionConfig
RunFunctionConfig builds a RunFunctionConfig for a FunctionIO.
func SetCompositionResourceName ¶ added in v1.1.0
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(s *PTFCompositionState)
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 APIDefaultCompositionUpdatePolicySelector ¶ added in v1.12.0
type APIDefaultCompositionUpdatePolicySelector struct {
// contains filtered or unexported fields
}
APIDefaultCompositionUpdatePolicySelector selects the default composition update policy referenced in the definition of the resource if neither a reference nor selector is given in composite resource.
func NewAPIDefaultCompositionUpdatePolicySelector ¶ added in v1.12.0
func NewAPIDefaultCompositionUpdatePolicySelector(c client.Client, ref corev1.ObjectReference, r event.Recorder) *APIDefaultCompositionUpdatePolicySelector
NewAPIDefaultCompositionUpdatePolicySelector returns a APIDefaultCompositionUpdatePolicySelector.
func (*APIDefaultCompositionUpdatePolicySelector) SelectCompositionUpdatePolicy ¶ added in v1.12.0
func (s *APIDefaultCompositionUpdatePolicySelector) SelectCompositionUpdatePolicy(ctx context.Context, cp resource.Composite) error
SelectCompositionUpdatePolicy selects the default composition update policy if neither a reference nor selector is given in composite resource.
type APIDryRunRenderer ¶
type APIDryRunRenderer struct {
// contains filtered or unexported fields
}
An APIDryRunRenderer renders composed resources. It may perform a dry-run create against an API server in order to name and validate the rendered resource.
func NewAPIDryRunRenderer ¶
func NewAPIDryRunRenderer(c client.Client) *APIDryRunRenderer
NewAPIDryRunRenderer returns a Renderer of composed resources that may perform a dry-run create against an API server in order to name and validate it.
func (*APIDryRunRenderer) Render ¶
func (r *APIDryRunRenderer) Render(ctx context.Context, cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate, env *env.Environment) error
Render the supplied composed resource using the supplied composite resource and template. The rendered resource may be submitted to an API server via a dry run create in order to name and validate it.
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 identifies the composed resource within a Composition or
// FunctionIO. 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 FunctionIO's observed/desired resources array.
ResourceName string
// 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 ComposedResourceDeleter ¶ added in v1.11.0
type ComposedResourceDeleter interface {
DeleteComposedResources(ctx context.Context, s *PTFCompositionState) error
}
A ComposedResourceDeleter deletes composed resources (and their state).
type ComposedResourceDeleterFn ¶ added in v1.11.0
type ComposedResourceDeleterFn func(ctx context.Context, s *PTFCompositionState) error
A ComposedResourceDeleterFn deletes composed resources (and their state).
func (ComposedResourceDeleterFn) DeleteComposedResources ¶ added in v1.11.0
func (fn ComposedResourceDeleterFn) DeleteComposedResources(ctx context.Context, s *PTFCompositionState) error
DeleteComposedResources deletes composed resources (and their state).
type ComposedResourceGetter ¶ added in v1.11.0
type ComposedResourceGetter interface {
GetComposedResources(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
}
A ComposedResourceGetter gets composed resource state.
type ComposedResourceGetterFn ¶ added in v1.11.0
type ComposedResourceGetterFn func(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
A ComposedResourceGetterFn gets composed resource state.
func (ComposedResourceGetterFn) GetComposedResources ¶ added in v1.11.0
func (fn ComposedResourceGetterFn) GetComposedResources(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
GetComposedResources gets composed resource state.
type ComposedResourceObserver ¶ added in v1.11.0
type ComposedResourceObserver interface {
ObserveComposedResources(ctx context.Context, s *PTFCompositionState) error
}
A ComposedResourceObserver derives additional state by observing composed resources.
type ComposedResourceObserverChain ¶ added in v1.11.0
type ComposedResourceObserverChain []ComposedResourceObserver
A ComposedResourceObserverChain runs a slice of ComposedResourceObservers.
func (ComposedResourceObserverChain) ObserveComposedResources ¶ added in v1.11.0
func (o ComposedResourceObserverChain) ObserveComposedResources(ctx context.Context, s *PTFCompositionState) error
ObserveComposedResources runs the slice of ComposedResourceObservers.
type ComposedResourceObserverFn ¶ added in v1.11.0
type ComposedResourceObserverFn func(ctx context.Context, s *PTFCompositionState) error
An ComposedResourceObserverFn derives additional state by observing composed resources.
func (ComposedResourceObserverFn) ObserveComposedResources ¶ added in v1.11.0
func (fn ComposedResourceObserverFn) ObserveComposedResources(ctx context.Context, s *PTFCompositionState) error
ObserveComposedResources derives additional state by observing composed resources.
type ComposedResourceState ¶ added in v1.11.0
type ComposedResourceState struct {
// State that is returned to the caller.
ComposedResource
// Things used to produce a composed resource.
Template *v1.ComposedTemplate
Desired *iov1alpha1.DesiredResource
// The state of the composed resource.
TemplateRenderErr error
Resource resource.Composed
ConnectionDetails managed.ConnectionDetails
}
ComposedResourceState tracks the state of a composed resource through the Composition process.
func MergeComposedResourceStates ¶ added in v1.11.0
func MergeComposedResourceStates(old, new ComposedResourceState) ComposedResourceState
MergeComposedResourceStates merges the new ComposedResourceState into the old one. It is used to update the result of a P&T composition with the result of a subsequent function composition operation on the same composed resource.
func ParseDesiredResource ¶ added in v1.11.0
func ParseDesiredResource(dr iov1alpha1.DesiredResource, owner resource.Object) (ComposedResourceState, error)
ParseDesiredResource parses a (composed) DesiredResource from a FunctionIO. It adds some labels and annotations that are required for Crossplane to track the composed resources, but otherwise tries to be relatively unopinionated. It does not for example automatically generate a name for the composed resource; the Composition Function must do so.
type ComposedResourceStates ¶ added in v1.11.0
type ComposedResourceStates map[string]ComposedResourceState
ComposedResourceStates is a map of (Composition) resource name to state. The key corresponds to the ResourceName field of the ComposedResource type.
func (ComposedResourceStates) Merge ¶ added in v1.11.0
func (rs ComposedResourceStates) Merge(s ComposedResourceState)
Merge the supplied composed resource state into the map of states. See MergeComposedResourceStates for details.
type Composer ¶ added in v1.11.0
type Composer interface {
Compose(ctx context.Context, xr resource.Composite, 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 resource.Composite, req CompositionRequest) (CompositionResult, error)
A ComposerFn composes resources.
func (ComposerFn) Compose ¶ added in v1.11.0
func (fn ComposerFn) Compose(ctx context.Context, xr resource.Composite, req CompositionRequest) (CompositionResult, error)
Compose resources.
type CompositionRequest ¶ added in v1.11.0
type CompositionRequest struct {
Revision *v1.CompositionRevision
Environment *env.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 CompositionUpdatePolicySelector ¶ added in v1.12.0
type CompositionUpdatePolicySelector interface {
SelectCompositionUpdatePolicy(ctx context.Context, cr resource.Composite) error
}
A CompositionUpdatePolicySelector selects a composition update policy.
type CompositionUpdatePolicySelectorFn ¶ added in v1.12.0
A CompositionUpdatePolicySelectorFn selects a composition update policy.
func (CompositionUpdatePolicySelectorFn) SelectCompositionUpdatePolicy ¶ added in v1.12.0
func (fn CompositionUpdatePolicySelectorFn) SelectCompositionUpdatePolicy(ctx context.Context, cr resource.Composite) error
SelectCompositionUpdatePolicy for the supplied composite resource.
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 ExtractConfigsFromDesired ¶ added in v1.11.0
func ExtractConfigsFromDesired(dr *iov1alpha1.DesiredResource) []ConnectionDetailExtractConfig
ExtractConfigsFromDesired builds extract configs for the supplied Composition Function desired state.
func ExtractConfigsFromTemplate ¶ added in v1.11.0
func ExtractConfigsFromTemplate(t *v1.ComposedTemplate) []ConnectionDetailExtractConfig
ExtractConfigsFromTemplate 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 ConnectionDetailsObserver ¶ added in v1.11.0
type ConnectionDetailsObserver struct {
// contains filtered or unexported fields
}
A ConnectionDetailsObserver extracts XR connection details from composed resource state. The details to extract are derived from each composed resource's P&T resource template and/or Composition Function desired state.
func NewConnectionDetailsObserver ¶ added in v1.11.0
func NewConnectionDetailsObserver(e ConnectionDetailsExtractor) *ConnectionDetailsObserver
NewConnectionDetailsObserver returns a ComposedResourceObserver that observes composed resources in order to extract XR connection details.
func (*ConnectionDetailsObserver) ObserveComposedResources ¶ added in v1.11.0
func (o *ConnectionDetailsObserver) ObserveComposedResources(_ context.Context, s *PTFCompositionState) error
ObserveComposedResources to extract XR connection details.
type ConnectionSecretFilterer ¶
type ConnectionSecretFilterer interface {
GetConnectionSecretKeys() []string
}
ConnectionSecretFilterer returns a set of allowed keys.
type ContainerFunctionRunner ¶ added in v1.11.0
type ContainerFunctionRunner interface {
RunFunction(ctx context.Context, fnio *iov1alpha1.FunctionIO, fn *v1.ContainerFunction, o ...ContainerFunctionRunnerOption) (*iov1alpha1.FunctionIO, error)
}
A ContainerFunctionRunner runs a containerized Composition Function.
type ContainerFunctionRunnerFn ¶ added in v1.11.0
type ContainerFunctionRunnerFn func(ctx context.Context, fnio *iov1alpha1.FunctionIO, fn *v1.ContainerFunction, o ...ContainerFunctionRunnerOption) (*iov1alpha1.FunctionIO, error)
A ContainerFunctionRunnerFn runs a containerized Composition Function.
func (ContainerFunctionRunnerFn) RunFunction ¶ added in v1.11.0
func (fn ContainerFunctionRunnerFn) RunFunction(ctx context.Context, fnio *iov1alpha1.FunctionIO, fnc *v1.ContainerFunction, o ...ContainerFunctionRunnerOption) (*iov1alpha1.FunctionIO, error)
RunFunction runs a containerized Composition Function.
type ContainerFunctionRunnerOption ¶ added in v1.13.0
type ContainerFunctionRunnerOption func(ctx context.Context, fn *v1.ContainerFunction, r *fnv1alpha1.RunFunctionRequest) error
A ContainerFunctionRunnerOption modifies the behavior of a ContainerFunctionRunner by mutating the supplied RunFunctionRequest.
func WithKubernetesAuthentication ¶ added in v1.13.0
func WithKubernetesAuthentication(c client.Reader, namespace, serviceAccount, registry string) ContainerFunctionRunnerOption
WithKubernetesAuthentication configures a ContainerFunctionRunner to use "Kubernetes" authentication to pull images from a private OCI registry. Kubernetes authentication emulates how the Kubelet pulls private images. Specifically, it:
1. Loads credentials from the Docker config file, if any. 2. Loads credentials from the supplied service account's image pull secrets. 3. Loads credentials from the function's image pull secrets. 4. Loads credentials using the GKE, EKS, or AKS credentials helper.
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 EnvironmentFetcher ¶ added in v1.11.0
type EnvironmentFetcher interface {
Fetch(ctx context.Context, cr resource.Composite, required bool) (*env.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, cr resource.Composite, required bool) (*env.Environment, error)
An EnvironmentFetcherFn fetches an appropriate environment for the supplied composite resource.
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 ExistingComposedResourceGetter ¶ added in v1.11.0
type ExistingComposedResourceGetter struct {
// contains filtered or unexported fields
}
An ExistingComposedResourceGetter uses an XR's resource references to load any existing composed resources from the API server. It also loads their connection details.
func NewExistingComposedResourceGetter ¶ added in v1.11.0
func NewExistingComposedResourceGetter(c client.Reader, f managed.ConnectionDetailsFetcher) *ExistingComposedResourceGetter
NewExistingComposedResourceGetter returns a ComposedResourceGetter that fetches an XR's existing composed resources.
func (*ExistingComposedResourceGetter) GetComposedResources ¶ added in v1.11.0
func (g *ExistingComposedResourceGetter) GetComposedResources(ctx context.Context, xr resource.Composite) (ComposedResourceStates, error)
GetComposedResources begins building composed resource state by fetching any existing composed resources referenced by the supplied composite resource, as well as their connection details.
type FallBackComposer ¶ added in v1.11.0
type FallBackComposer struct {
// contains filtered or unexported fields
}
A FallBackComposer wraps two Composers - one preferred and one fallback. If the trigger FallBackFn returns true it will use the fallback rather than the preferred Composer.
func NewFallBackComposer ¶ added in v1.11.0
func NewFallBackComposer(preferred, fallback Composer, fn TriggerFn) *FallBackComposer
NewFallBackComposer returns a Composer that calls the preferred Composer unless the supplied TriggerFn triggers a fallback to the fallback Composer.
func (*FallBackComposer) Compose ¶ added in v1.11.0
func (c *FallBackComposer) Compose(ctx context.Context, xr resource.Composite, req CompositionRequest) (CompositionResult, error)
Compose calls either the preferred or fallback Composer's Compose method depending on the result of the TriggerFn.
type FunctionPipeline ¶ added in v1.11.0
type FunctionPipeline struct {
// contains filtered or unexported fields
}
A FunctionPipeline runs a pipeline of Composition Functions.
func NewFunctionPipeline ¶ added in v1.11.0
func NewFunctionPipeline(c ContainerFunctionRunner, o ...ContainerFunctionRunnerOption) *FunctionPipeline
NewFunctionPipeline returns a FunctionPipeline that runs functions using the supplied ContainerFunctionRunner.
func (*FunctionPipeline) RunFunctionPipeline ¶ added in v1.11.0
func (p *FunctionPipeline) RunFunctionPipeline(ctx context.Context, req CompositionRequest, s *PTFCompositionState, o iov1alpha1.Observed, d iov1alpha1.Desired) error
RunFunctionPipeline runs a pipeline of Composition Functions.
type FunctionPipelineRunner ¶ added in v1.11.0
type FunctionPipelineRunner interface {
RunFunctionPipeline(ctx context.Context, req CompositionRequest, s *PTFCompositionState, o iov1alpha1.Observed, d iov1alpha1.Desired) error
}
A FunctionPipelineRunner runs a pipeline of Composition Functions.
type FunctionPipelineRunnerFn ¶ added in v1.11.0
type FunctionPipelineRunnerFn func(ctx context.Context, req CompositionRequest, s *PTFCompositionState, o iov1alpha1.Observed, d iov1alpha1.Desired) error
A FunctionPipelineRunnerFn runs a pipeline of Composition Functions.
func (FunctionPipelineRunnerFn) RunFunctionPipeline ¶ added in v1.11.0
func (fn FunctionPipelineRunnerFn) RunFunctionPipeline(ctx context.Context, req CompositionRequest, s *PTFCompositionState, o iov1alpha1.Observed, d iov1alpha1.Desired) error
RunFunctionPipeline runs a pipeline of Composition Functions.
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 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 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 resource.Composite, req CompositionRequest) (CompositionResult, error)
Compose resources using the bases, patches, and transforms specified by the supplied Composition.
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 WithComposedReadinessChecker ¶ added in v1.11.0
func WithComposedReadinessChecker(r ReadinessChecker) PTComposerOption
WithComposedReadinessChecker configures how a PatchAndTransformComposer checks composed resource readiness.
func WithComposedRenderer ¶ added in v1.11.0
func WithComposedRenderer(r Renderer) PTComposerOption
WithComposedRenderer configures how a PatchAndTransformComposer renders composed resources.
func WithCompositeRenderer ¶ added in v1.1.0
func WithCompositeRenderer(r Renderer) PTComposerOption
WithCompositeRenderer configures how a PatchAndTransformComposer renders the composite resource.
func WithTemplateAssociator ¶ added in v1.11.0
func WithTemplateAssociator(a CompositionTemplateAssociator) PTComposerOption
WithTemplateAssociator configures how a PatchAndTransformComposer associates templates with extant composed resources.
type PTFComposer ¶ added in v1.11.0
type PTFComposer struct {
// contains filtered or unexported fields
}
A PTFComposer (i.e. Patch, Transform, and Function Composer) supports composing resources using both Patch and Transform (P&T) logic and a pipeline of Composition Functions. Callers may mix P&T with Composition Functions or use only one or the other. It does not support anonymous, unnamed resource templates and will panic if it encounters one.
func NewPTFComposer ¶ added in v1.11.0
func NewPTFComposer(kube client.Client, o ...PTFComposerOption) *PTFComposer
NewPTFComposer returns a new Composer that supports composing resources using both Patch and Transform (P&T) logic and a pipeline of Composition Functions.
func (*PTFComposer) Compose ¶ added in v1.11.0
func (c *PTFComposer) Compose(ctx context.Context, xr resource.Composite, req CompositionRequest) (CompositionResult, error)
Compose resources using both either the Patch & Transform style resources array, the functions array, or both.
type PTFComposerOption ¶ added in v1.11.0
type PTFComposerOption func(*PTFComposer)
A PTFComposerOption is used to configure a PTFComposer.
func WithComposedResourceDeleter ¶ added in v1.11.0
func WithComposedResourceDeleter(d ComposedResourceDeleter) PTFComposerOption
WithComposedResourceDeleter configures how the PTFComposer should delete undesired composed resources.
func WithComposedResourceGetter ¶ added in v1.11.0
func WithComposedResourceGetter(g ComposedResourceGetter) PTFComposerOption
WithComposedResourceGetter configures how the PTFComposer should get existing composed resources.
func WithComposedResourceObserver ¶ added in v1.11.0
func WithComposedResourceObserver(o ComposedResourceObserver) PTFComposerOption
WithComposedResourceObserver configures how the PTFComposer should observe composed resources after applying them.
func WithCompositeConnectionDetailsFetcher ¶ added in v1.11.0
func WithCompositeConnectionDetailsFetcher(f managed.ConnectionDetailsFetcher) PTFComposerOption
WithCompositeConnectionDetailsFetcher configures how the PTFComposer should get the composite resource's connection details.
func WithFunctionPipelineRunner ¶ added in v1.11.0
func WithFunctionPipelineRunner(r FunctionPipelineRunner) PTFComposerOption
WithFunctionPipelineRunner configures how the PTFComposer should run a pipeline of Composition Functions.
func WithPatchAndTransformer ¶ added in v1.11.0
func WithPatchAndTransformer(pt PatchAndTransformer) PTFComposerOption
WithPatchAndTransformer configures how the PTFComposer should run Patch & Transform (P&T) Composition.
type PTFCompositionState ¶ added in v1.11.0
type PTFCompositionState struct {
Composite resource.Composite
ConnectionDetails managed.ConnectionDetails
ComposedResources ComposedResourceStates
Events []event.Event
}
PTFCompositionState is used throughout the PTFComposer to track its state.
type PatchAndTransformer ¶ added in v1.11.0
type PatchAndTransformer interface {
PatchAndTransform(ctx context.Context, req CompositionRequest, s *PTFCompositionState) error
}
A PatchAndTransformer runs P&T Composition.
type PatchAndTransformerFn ¶ added in v1.11.0
type PatchAndTransformerFn func(ctx context.Context, req CompositionRequest, s *PTFCompositionState) error
A PatchAndTransformerFn runs P&T Composition.
func (PatchAndTransformerFn) PatchAndTransform ¶ added in v1.11.0
func (fn PatchAndTransformerFn) PatchAndTransform(ctx context.Context, req CompositionRequest, s *PTFCompositionState) error
PatchAndTransform runs P&T Composition.
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 ReadinessCheckFromDesiredReadinessCheck ¶ added in v1.13.0
func ReadinessCheckFromDesiredReadinessCheck(in *iov1alpha1.DesiredReadinessCheck) ReadinessCheck
ReadinessCheckFromDesiredReadinessCheck derives a ReadinessCheck from the supplied iov1alpha1.DesiredReadinessCheck.
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 ReadinessChecksFromDesiredResource ¶ added in v1.13.0
func ReadinessChecksFromDesiredResource(dr *iov1alpha1.DesiredResource) []ReadinessCheck
ReadinessChecksFromDesiredResource derives readiness checks from the supplied desired resource.
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" 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 ReadinessObserver ¶ added in v1.11.0
type ReadinessObserver struct {
// contains filtered or unexported fields
}
A ReadinessObserver observes composed resource state and updates it to indicate whether each composed resource is ready per the readiness checks associated with each resource, which are derived from their P&T resource template and/or Composition Function desired state.
func NewReadinessObserver ¶ added in v1.11.0
func NewReadinessObserver(c ReadinessChecker) *ReadinessObserver
NewReadinessObserver returns a ComposedResourceObserver that observes whether composed resources are ready.
func (*ReadinessObserver) ObserveComposedResources ¶ added in v1.11.0
func (o *ReadinessObserver) ObserveComposedResources(ctx context.Context, s *PTFCompositionState) error
ObserveComposedResources to determine their readiness.
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 WithCompositionUpdatePolicySelector ¶ added in v1.12.0
func WithCompositionUpdatePolicySelector(s CompositionUpdatePolicySelector) ReconcilerOption
WithCompositionUpdatePolicySelector specifies how the composition update policy 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 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 Renderer ¶
type Renderer interface {
Render(ctx context.Context, cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate, env *env.Environment) error
}
A Renderer is used to render a composed resource.
type RendererFn ¶
type RendererFn func(ctx context.Context, cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate, env *env.Environment) error
A RendererFn may be used to render a composed resource.
func (RendererFn) Render ¶
func (fn RendererFn) Render(ctx context.Context, cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate, env *env.Environment) error
Render the supplied composed resource using the supplied composite resource and template as inputs.
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.
type TriggerFn ¶ added in v1.11.0
type TriggerFn func(ctx context.Context, xr resource.Composite, req CompositionRequest) (bool, error)
A TriggerFn lets a FallBackComposer know when it should fall back from the preferred to the fallback Composer.
func FallBackForAnonymousTemplates ¶ added in v1.11.0
FallBackForAnonymousTemplates returns a TriggerFn that triggers a fallback if the supplied Composition uses anonymous templates, or the supplied XR references composed resources that appear to have been created by an anonymous template. We use this to fall back from the PTFComposer to the PTComposer when Composition Functions are enabled.
The PTFComposer does not support anonymous templates; it requires named resources to map from P&T resources to FunctionIO resources. A validator ensures that its not possible to create a Composition that uses both Composition Functions and anonymous resource templates.
type UndesiredComposedResourceDeleter ¶ added in v1.11.0
type UndesiredComposedResourceDeleter struct {
// contains filtered or unexported fields
}
An UndesiredComposedResourceDeleter deletes composed resources from the API server and from Composition state if their state doesn't include a FunctionIO desired resource. This indicates the composed resource either exists or was going to be created by P&T composition, but didn't survive the Composition Function pipeline.
func NewUndesiredComposedResourceDeleter ¶ added in v1.11.0
func NewUndesiredComposedResourceDeleter(c client.Writer) *UndesiredComposedResourceDeleter
NewUndesiredComposedResourceDeleter returns a ComposedResourceDeleter that deletes undesired composed resources from both the API server and Composition state.
func (*UndesiredComposedResourceDeleter) DeleteComposedResources ¶ added in v1.11.0
func (d *UndesiredComposedResourceDeleter) DeleteComposedResources(ctx context.Context, s *PTFCompositionState) error
DeleteComposedResources 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). Composed resources are deleted from both the supposed composition state and from the API server.
type XRCDPatchAndTransformer ¶ added in v1.11.0
type XRCDPatchAndTransformer struct {
// contains filtered or unexported fields
}
An XRCDPatchAndTransformer runs a Composition's Patches & Transforms against both the XR and composed resources.
func NewXRCDPatchAndTransformer ¶ added in v1.11.0
func NewXRCDPatchAndTransformer(composite, composed Renderer) *XRCDPatchAndTransformer
NewXRCDPatchAndTransformer returns a PatchAndTransformer that runs Patches and Transforms against both the XR and composed resources.
func (*XRCDPatchAndTransformer) PatchAndTransform ¶ added in v1.11.0
func (pt *XRCDPatchAndTransformer) PatchAndTransform(ctx context.Context, req CompositionRequest, s *PTFCompositionState) error
PatchAndTransform updates the supplied composition state by running all patches and transforms within the CompositionRequest.