inject

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package inject defines interfaces and functions for propagating dependencies from a ControllerManager to the components registered with it. Dependencies are propagated to Reconciler, Source, EventHandler and Predicate objects which implement the Injectable interfaces.

Package inject is used by a Manager to inject types into Sources, EventHandlers, Predicates, and Reconciles. Deprecated: Use manager.Options fields directly. This package will be removed in v0.10.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIReaderInto added in v0.2.0

func APIReaderInto(reader client.Reader, i interface{}) (bool, error)

APIReaderInto will set APIReader on i and return the result if it implements APIReaderInto. Returns false if i does not implement APIReader.

func CacheInto

func CacheInto(c cache.Cache, i interface{}) (bool, error)

CacheInto will set informers on i and return the result if it implements Cache. Returns false if i does not implement Cache.

func ClientInto

func ClientInto(client client.Client, i interface{}) (bool, error)

ClientInto will set client on i and return the result if it implements Client. Returns false if i does not implement Client.

func ConfigInto

func ConfigInto(config *rest.Config, i interface{}) (bool, error)

ConfigInto will set config on i and return the result if it implements Config. Returns false if i does not implement Config.

func InjectorInto

func InjectorInto(f Func, i interface{}) (bool, error)

InjectorInto will set f and return the result on i if it implements Injector. Returns false if i does not implement Injector.

func LoggerInto added in v0.2.0

func LoggerInto(l logr.Logger, i interface{}) (bool, error)

LoggerInto will set the logger on the given object if it implements inject.Logger, returning true if a InjectLogger was called, and false otherwise.

func MapperInto added in v0.2.0

func MapperInto(mapper meta.RESTMapper, i interface{}) (bool, error)

MapperInto will set the rest mapper on i and return the result if it implements Mapper. Returns false if i does not implement Mapper.

func SchemeInto

func SchemeInto(scheme *runtime.Scheme, i interface{}) (bool, error)

SchemeInto will set scheme and return the result on i if it implements Scheme. Returns false if i does not implement Scheme.

func StopChannelInto

func StopChannelInto(stop <-chan struct{}, i interface{}) (bool, error)

StopChannelInto will set stop channel on i and return the result if it implements Stoppable. Returns false if i does not implement Stoppable.

Types

type APIReader added in v0.2.0

type APIReader interface {
	InjectAPIReader(client.Reader) error
}

APIReader is used by the Manager to inject the APIReader into necessary types.

type Cache

type Cache interface {
	InjectCache(cache cache.Cache) error
}

Cache is used by the ControllerManager to inject Cache into Sources, EventHandlers, Predicates, and Reconciles.

type Client

type Client interface {
	InjectClient(client.Client) error
}

Client is used by the ControllerManager to inject client into Sources, EventHandlers, Predicates, and Reconciles.

type Config

type Config interface {
	InjectConfig(*rest.Config) error
}

Config is used by the ControllerManager to inject Config into Sources, EventHandlers, Predicates, and Reconciles.

type Func

type Func func(i interface{}) error

Func injects dependencies into i.

type Injector

type Injector interface {
	InjectFunc(f Func) error
}

Injector is used by the ControllerManager to inject Func into Controllers.

type Logger added in v0.2.0

type Logger interface {
	InjectLogger(l logr.Logger) error
}

Logger is used to inject Loggers into components that need them and don't otherwise have opinions.

type Mapper added in v0.2.0

type Mapper interface {
	InjectMapper(meta.RESTMapper) error
}

Mapper is used to inject the rest mapper to components that may need it.

type Scheme

type Scheme interface {
	InjectScheme(scheme *runtime.Scheme) error
}

Scheme is used by the ControllerManager to inject Scheme into Sources, EventHandlers, Predicates, and Reconciles.

type Stoppable

type Stoppable interface {
	InjectStopChannel(<-chan struct{}) error
}

Stoppable is used by the ControllerManager to inject stop channel into Sources, EventHandlers, Predicates, and Reconciles.

Jump to

Keyboard shortcuts

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