composite

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ControllerName

func ControllerName(name string) string

ControllerName returns the recommended name for controllers that use this package to reconcile a particular kind of composite resource.

func IsReady

IsReady returns whether the composed resource is ready.

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, comp *v1.Composition) error

Configure any required fields that were omitted from the composite resource by copying them from its composition.

type APIConnectionDetailsFetcher

type APIConnectionDetailsFetcher struct {
	// contains filtered or unexported fields
}

An APIConnectionDetailsFetcher may use the API server to read connection details from a Secret.

func NewAPIConnectionDetailsFetcher

func NewAPIConnectionDetailsFetcher(c client.Client) *APIConnectionDetailsFetcher

NewAPIConnectionDetailsFetcher returns a ConnectionDetailsFetcher that may use the API server to read connection details from a Secret.

func (*APIConnectionDetailsFetcher) FetchConnectionDetails

FetchConnectionDetails of the supplied composed resource, if any.

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 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

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

PublishConnection publishes the supplied ConnectionDetails to the Secret referenced in the resource.

func (*APIFilteredSecretPublisher) UnpublishConnection

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

Configure the supplied composite resource's root name prefix.

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

type CompositionSelectorFn func(ctx context.Context, cr resource.Composite) error

A CompositionSelectorFn selects a composition reference.

func (CompositionSelectorFn) SelectComposition

func (fn CompositionSelectorFn) SelectComposition(ctx context.Context, cr resource.Composite) error

SelectComposition for the supplied composite resource.

type Configurator

type Configurator interface {
	Configure(ctx context.Context, cr resource.Composite, cp *v1.Composition) 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, comp *v1.Composition) error

Configure calls Configure function of every Configurator in the list.

type ConfiguratorFn

type ConfiguratorFn func(ctx context.Context, cr resource.Composite, cp *v1.Composition) error

A ConfiguratorFn configures a composite resource using its composition.

func (ConfiguratorFn) Configure

func (fn ConfiguratorFn) Configure(ctx context.Context, cr resource.Composite, cp *v1.Composition) error

Configure the supplied composite resource using its composition.

type ConnectionDetailsFetcher

type ConnectionDetailsFetcher interface {
	FetchConnectionDetails(ctx context.Context, cd resource.Composed, t v1.ComposedTemplate) (managed.ConnectionDetails, error)
}

ConnectionDetailsFetcher fetches the connection details of the Composed resource.

type ConnectionDetailsFetcherFn

type ConnectionDetailsFetcherFn func(ctx context.Context, cd resource.Composed, t v1.ComposedTemplate) (managed.ConnectionDetails, error)

A ConnectionDetailsFetcherFn fetches the connection details of the supplied composed resource, if any.

func (ConnectionDetailsFetcherFn) FetchConnectionDetails

FetchConnectionDetails calls the FetchConnectionDetailsFn.

type ConnectionPublisher

type ConnectionPublisher interface {
	// PublishConnection details for the supplied resource. Publishing must be
	// additive; i.e. if details (a, b, c) are published, subsequently
	// publishing details (b, c, d) should update (b, c) but not remove a.
	// Returns 'published' if the publish was not a no-op.
	PublishConnection(ctx context.Context, o resource.ConnectionSecretOwner, c managed.ConnectionDetails) (published bool, err error)
}

A ConnectionPublisher publishes the supplied ConnectionDetails for the supplied resource. Publishers must handle the case in which the supplied ConnectionDetails are empty.

type ConnectionPublisherFn

type ConnectionPublisherFn func(ctx context.Context, o resource.ConnectionSecretOwner, c managed.ConnectionDetails) (published bool, err error)

A ConnectionPublisherFn publishes the supplied ConnectionDetails for the supplied resource.

func (ConnectionPublisherFn) PublishConnection

func (fn ConnectionPublisherFn) PublishConnection(ctx context.Context, o resource.ConnectionSecretOwner, c managed.ConnectionDetails) (published bool, err error)

PublishConnection details for the supplied resource.

type ConnectionSecretFilterer

type ConnectionSecretFilterer interface {
	GetConnectionSecretKeys() []string
}

ConnectionSecretFilterer returns a set of allowed keys.

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 Observation

type Observation struct {
	Ref               corev1.ObjectReference
	ConnectionDetails managed.ConnectionDetails
	Ready             bool
}

Observation is the result of composed reconciliation.

type ReadinessChecker

type ReadinessChecker interface {
	IsReady(ctx context.Context, cd resource.Composed, t v1.ComposedTemplate) (ready bool, err error)
}

A ReadinessChecker checks whether a composed resource is ready or not.

type ReadinessCheckerFn

type ReadinessCheckerFn func(ctx context.Context, cd resource.Composed, t v1.ComposedTemplate) (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, cd resource.Composed, t v1.ComposedTemplate) (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.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error)

Reconcile a composite resource.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

ReconcilerOption is used to configure the Reconciler.

func WithClientApplicator

func WithClientApplicator(ca resource.ClientApplicator) ReconcilerOption

WithClientApplicator specifies how the Reconciler should interact with the Kubernetes API.

func WithCompositionSelector

func WithCompositionSelector(p 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 WithConnectionDetailsFetcher

func WithConnectionDetailsFetcher(f ConnectionDetailsFetcher) ReconcilerOption

WithConnectionDetailsFetcher specifies how the Reconciler should fetch the connection details of composed resources.

func WithConnectionPublisher

func WithConnectionPublisher(p ConnectionPublisher) ReconcilerOption

WithConnectionPublisher specifies how the Reconciler should publish connection secrets.

func WithLogger

func WithLogger(log logging.Logger) ReconcilerOption

WithLogger specifies how the Reconciler should log messages.

func WithReadinessChecker

func WithReadinessChecker(c ReadinessChecker) ReconcilerOption

WithReadinessChecker specifies how the Reconciler should fetch the connection details of composed resources.

func WithRecorder

func WithRecorder(er event.Recorder) ReconcilerOption

WithRecorder specifies how the Reconciler should record Kubernetes events.

func WithRenderer

func WithRenderer(rd Renderer) ReconcilerOption

WithRenderer specifies how the Reconciler should render composed resources.

type RenderFn

type RenderFn func(cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate) error

A RenderFn renders the supplied composed resource.

func (RenderFn) Render

Render calls RenderFn.

type Renderer

type Renderer interface {
	Render(ctx context.Context, cp resource.Composite, cd resource.Composed, t v1.ComposedTemplate) 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) error

A RendererFn may be used to render a composed resource.

func (RendererFn) Render

Render the supplied composed resource using the supplied composite resource and template as inputs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL