managedresource

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: Apache-2.0, MIT Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const ControllerName = "resource-controller"

ControllerName is the name of the managedresource controller.

Variables

This section is empty.

Functions

func AddToManager

func AddToManager(mgr manager.Manager) error

AddToManager adds the controller to a Manager using the default config.

func AddToManagerWithOptions

func AddToManagerWithOptions(mgr manager.Manager, conf ControllerConfig) error

AddToManagerWithOptions adds the controller to a Manager with the given config.

Types

type ControllerConfig

type ControllerConfig struct {
	MaxConcurrentWorkers      int
	SyncPeriod                time.Duration
	ClassFilter               *filter.ClassFilter
	AlwaysUpdate              bool
	ClusterID                 string
	GarbageCollectorActivated bool

	TargetClientConfig resourcemanagercmd.TargetClientConfig
}

ControllerConfig is the completed configuration for the controller.

func (*ControllerConfig) ApplyClassFilter

func (c *ControllerConfig) ApplyClassFilter(filter *filter.ClassFilter)

ApplyClassFilter sets filter to the ClassFilter of this config.

func (*ControllerConfig) ApplyDefaultClusterId added in v0.22.0

func (c *ControllerConfig) ApplyDefaultClusterId(ctx context.Context, log logr.Logger, restcfg *rest.Config) error

ApplyDefaultClusterId sets the cluster id according to a dedicated cluster access

type ControllerOptions

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

ControllerOptions are options for adding the controller to a Manager.

func (*ControllerOptions) AddFlags

func (o *ControllerOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds the needed command line flags to the given FlagSet.

func (*ControllerOptions) Complete

func (o *ControllerOptions) Complete() error

Complete completes the given command line flags and set the defaultControllerConfig accordingly.

func (*ControllerOptions) Completed

func (o *ControllerOptions) Completed() *ControllerConfig

Completed returns the completed ControllerConfig.

type EquivalenceSet

type EquivalenceSet map[metav1.GroupKind]struct{}

EquivalenceSet is a set of GroupKinds which should be considered as equivalent representation of an Object Kind.

func (EquivalenceSet) Insert

func (s EquivalenceSet) Insert(gks ...metav1.GroupKind) EquivalenceSet

Insert adds the given GroupKinds to the EquivalenceSet

type Equivalences

type Equivalences map[metav1.GroupKind]EquivalenceSet

Equivalences is a set of EquivalenceSets, which can be used to look up equivalent GroupKinds for a given GroupKind.

func NewEquivalences

func NewEquivalences(additionalEquivalences ...[]metav1.GroupKind) Equivalences

NewEquivalences constructs a new Equivalences object, which can be used to look up equivalent GroupKinds for a given GroupKind. It already has some default equivalences predefined (e.g. for Kind `Deployment` in Group `apps` and `extensions`). It can optionally take additional lists of GroupKinds which should be considered as equivalent representations of the respective Object Kinds.

func (Equivalences) GetEquivalencesFor

func (e Equivalences) GetEquivalencesFor(gk metav1.GroupKind) EquivalenceSet

GetEquivalencesFor looks up which GroupKinds should be considered as equivalent to a given GroupKind.

type ObjectIndex

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

func NewObjectIndex

func NewObjectIndex(references []resourcesv1alpha1.ObjectReference, withEquivalences Equivalences) *ObjectIndex

NewObjectIndex constructs a new *ObjectIndex containing all the given ObjectReferences. It can optionally be configured to use a set of rules, defining what GroupKinds to consider equivalent when looking up references using `Lookup()`, by passing in an `Equivalences` object. If the `Equivalences` object is nil, then references are only considered as equivalent if their GroupKinds are equal.

func (*ObjectIndex) Found

Found checks if a given ObjectReference was found previously by a call to `Lookup()`.

func (*ObjectIndex) Lookup

Lookup checks if the index contains a given ObjectReference. It also considers cross API group equivalences configured by the Equivalences object handed to NewObjectIndex(). It returns the found ObjectReference and a bool indicating if it was found. If the reference (or equivalent one) was found it is marked as `found`, which can be later checked by using `Found()`.

func (*ObjectIndex) Objects

Objects returns a map containing all ObjectReferences of the index. It maps keys of the contained objects (in the form `Group/Kind/Namespace/Name`) to ObjectReferences.

type Reconciler

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

Reconciler contains information in order to reconcile instances of ManagedResource.

func (*Reconciler) InjectClient

func (r *Reconciler) InjectClient(c client.Client) error

InjectClient injects a client into the reconciler.

func (*Reconciler) InjectLogger

func (r *Reconciler) InjectLogger(l logr.Logger) error

InjectLogger injects a logger into the reconciler.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile implements `reconcile.Reconciler`.

Jump to

Keyboard shortcuts

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