manager

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 28 Imported by: 42

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

	// 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 ControllerUpgrader added in v1.7.0

type ControllerUpgrader interface {
	// Upgrade allows version based upgrades of managed resources.
	Upgrade(ctx context.Context, cli client.Client, options *options.Options) error
}

ControllerUpgrader optionally allows the factory to define an upgrade procedure. DO NOT MODIFY THE SPEC EVER, you have CRD defaulting to fill in any blanks. Only things like metadata can be touched, or the resources can be moved around. Typically you would want to attach a controller version annotation to define what API the resource is using, then drive upgrades based on that.

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.

type RemoteReconciler added in v1.6.0

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

RemoteReconciler is a generic reconciler for all manager types. The key difference between this an the base reconciler is that the base is for types managed by that package, whereas this is for types managed by another. This is used primarily as a Kubernetes interface that provides a message queue like function e.g. a compute cluster controller can react to project life cycle events initiated by the identity service.

func NewRemoteReconciler added in v1.6.0

func NewRemoteReconciler(options *options.Options, controllerOptions ControllerOptions, manager manager.Manager, createProvisioner ProvisionerCreateFunc) *RemoteReconciler

NewRemoteReconciler creates a new reconciler.

func (*RemoteReconciler) Reconcile added in v1.6.0

func (r *RemoteReconciler) 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