xrd

package
v0.0.0-...-c54dba7 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClaimCRDName

GetClaimCRDName returns the name of the claim CRD that's created as result of given CompositeResourceDefinition.

func GroupVersionKindOf

GroupVersionKindOf returns the served GroupVersionKind of given CRD.

func Setup

func Setup(mgr manager.Manager, remoteClient client.Client, logger logging.Logger) error

Setup adds a controller that will reconcile CompositeResourceDefinitions that offer resource claim in the local cluster and create CRDs & controllers that will reconcile those new types.

Types

type APIRemoteCRDFetcher

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

APIRemoteCRDFetcher gets the sanitized form of the claim CRD of given CompositeResourceDefinition by fetching it from remote cluster and stripping out cluster-specific metadata.

func NewAPIRemoteCRDFetcher

func NewAPIRemoteCRDFetcher(client client.Client) *APIRemoteCRDFetcher

NewAPIRemoteCRDFetcher returns a new APIRemoteCRDFetcher.

func (*APIRemoteCRDFetcher) Fetch

Fetch returns the sanitized form of the claim CRD of given CompositeResourceDefinition by fetching it from remote cluster and stripping out cluster-specific metadata.

type CRDFetcher

type CRDFetcher interface {
	Fetch(ctx context.Context, ip v1alpha1.CompositeResourceDefinition) (*v1beta1.CustomResourceDefinition, error)
}

CRDFetcher can be satisfied with objects that can return a CRD with CompositeResourceDefinition information.

type ControllerEngine

type ControllerEngine interface {
	Start(name string, o kcontroller.Options, w ...controller.Watch) error
	Stop(name string)
}

ControllerEngine can be satisfied with objects that can start and stop a controller.

type FetchFn

FetchFn is used to provide a single function instead of a full object to satisfy Fetch interface.

func (FetchFn) Fetch

Fetch calls FetchFn it belongs to.

type NopFetcher

type NopFetcher struct{}

NopFetcher does nothing.

func NewNopFetcher

func NewNopFetcher() NopFetcher

NewNopFetcher returns a NopFetcher.

func (NopFetcher) Fetch

Fetch does nothing.

type Reconciler

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

Reconciler watches the CompositeResourceDefinition with resource claim offerings in the cluster and creates a CRD for each of them with spec that is fetched via supplied CRDFetcher. Then it creates a controller for each new type that will sync the instances of that type from local cluster to remote cluster.

func NewReconciler

func NewReconciler(mgr manager.Manager, remoteClient client.Client, opts ...ReconcilerOption) *Reconciler

NewReconciler returns a new *Reconciler.

func (*Reconciler) Reconcile

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

Reconcile reconciles CompositeResourceDefinition and does the necessary operations to bootstrap reconciliation of that new type defined by CompositeResourceDefinition.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

ReconcilerOption is used to configure *Reconciler.

func WithCRDFetcher

func WithCRDFetcher(re CRDFetcher) ReconcilerOption

WithCRDFetcher specifies how the Reconciler should fetch CRDs of claims.

func WithControllerEngine

func WithControllerEngine(c ControllerEngine) ReconcilerOption

WithControllerEngine specifies how the Reconciler should start and stop controllers.

func WithFinalizer

WithFinalizer specifies how the Reconciler should add and remove finalizers.

func WithLocalApplicator

func WithLocalApplicator(a runtimeresource.Applicator) ReconcilerOption

WithLocalApplicator specifies what Applicator in local cluster Reconciler should use.

func WithLogger

func WithLogger(log logging.Logger) ReconcilerOption

WithLogger specifies how the Reconciler should log messages.

func WithRecorder

func WithRecorder(er event.Recorder) ReconcilerOption

WithRecorder specifies how the Reconciler should record Kubernetes events.

Jump to

Keyboard shortcuts

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