manager

package
v0.1.79 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 28 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrResourceError is raised when this is used with an unsupported resource
	// kind.
	ErrResourceError = errors.New("unable to assert resource type")
)

Functions

func FromContext

func FromContext(ctx context.Context) manager.Manager

func NewContext

func NewContext(ctx context.Context, manager manager.Manager) context.Context

func Run

func Run(f ControllerFactory)

Run provides common manager initialization and execution.

Types

type ControllerFactory

type ControllerFactory interface {
	// Metadata returns the application, version and revision.
	Metadata() (string, string, string)

	// Options may be nil, otherwise it's a controller specific set of
	// options that are added to the flagset on start up and passed to the
	// reonciler.
	Options() ControllerOptions

	// Reconciler returns a new reconciler instance.
	Reconciler(options *options.Options, controllerOptions ControllerOptions, manager manager.Manager) reconcile.Reconciler

	// RegisterWatches adds any watches that would trigger a reconcile.
	RegisterWatches(manager manager.Manager, controller controller.Controller) error

	// Upgrade allows version based upgrades of managed resources.
	// DO NOT MODIFY THE SPEC EVER.  Only things like metadata can
	// be touched.
	Upgrade(client client.Client) error

	// Schemes allows controllers to add types to the client beyond
	// the defaults defined in this repository.
	Schemes() []coreclient.SchemeAdder
}

ControllerFactory allows creation of a Unikorn controller with minimal code.

type ControllerOptions added in v0.1.65

type ControllerOptions interface {
	// AddFlags adds a set of flags to the flagset.
	AddFlags(f *pflag.FlagSet)
}

ControllerOptions abstracts controller specific flags.

type ProvisionerCreateFunc

type ProvisionerCreateFunc func(ControllerOptions) provisioners.ManagerProvisioner

ProvisionerCreateFunc provides a type agnosic method to create a root provisioner.

type Reconciler

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

Reconciler is a generic reconciler for all manager types.

func NewReconciler

func NewReconciler(options *options.Options, controllerOptions ControllerOptions, manager manager.Manager, createProvisioner ProvisionerCreateFunc) *Reconciler

NewReconciler creates a new reconciler.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

Reconcile is the top-level reconcile interface that controller-runtime will dispatch to. It initialises the provisioner, extracts the request object and based on whether it exists or not, reconciles or deletes the object respectively.

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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