controller

package
v0.3.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MPL-2.0 Imports: 4 Imported by: 3

Documentation

Overview

Package controller defines common interfaces to be implemented by the controllers and controller runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	Name() string
	Inputs() []Input
	Outputs() []Output

	Run(context.Context, Runtime, *zap.Logger) error
}

Controller interface should be implemented by Controllers.

type DependencyEdge

type DependencyEdge struct {
	ControllerName string

	ResourceNamespace resource.Namespace
	ResourceType      resource.Type
	ResourceID        resource.ID

	EdgeType DependencyEdgeType
}

DependencyEdge represents relationship between controller and resource(s).

type DependencyEdgeType

type DependencyEdgeType int

DependencyEdgeType is edge type in controller graph.

const (
	EdgeOutputExclusive DependencyEdgeType = iota
	EdgeOutputShared
	EdgeInputStrong
	EdgeInputWeak
	EdgeInputDestroyReady
)

Controller graph edge types.

type DependencyGraph

type DependencyGraph struct {
	Edges []DependencyEdge
}

DependencyGraph is the exported information about controller/resources dependencies.

type Engine

type Engine interface {
	// RegisterController registers new controller.
	RegisterController(ctrl Controller) error
	// Run the controllers.
	Run(ctx context.Context) error
}

Engine is the entrypoint into Controller Runtime.

type Input

type Input struct {
	ID        *resource.ID
	Namespace resource.Namespace
	Type      resource.Type
	Kind      InputKind
}

Input of the controller (dependency on some resource(s)).

Each controller might have multiple inputs, it might depend on all the objects of some type under namespace, or on specific object by ID.

Input might be either Weak or Strong. Any kind of input triggers cascading reconcile on changes, Strong dependencies in addition block deletion of parent object until all the dependencies are torn down.

Input can also be "DestroyReady" which means that the controller is watching some of its outputs to be ready to be destroyed. Controller will be notified when the resource enters "teardown" phase and has no finalizers attached. Resources are filtered to be owned by the controller.

type InputKind

type InputKind = int

InputKind for inputs.

const (
	InputWeak InputKind = iota
	InputStrong
	InputDestroyReady
)

Input kinds.

type Output

type Output struct {
	Type resource.Type
	Kind OutputKind
}

Output of the controller.

Controller can only modify resources which are declared as outputs.

type OutputKind

type OutputKind = int

OutputKind for outputs.

const (
	OutputExclusive OutputKind = iota
	OutputShared
)

Output kinds.

type Reader

Reader provides read-only access to the state.

state.State also satisfies this interface.

type ReconcileEvent

type ReconcileEvent struct{}

ReconcileEvent is a signal for controller to reconcile its resources.

type Runtime

type Runtime interface {
	EventCh() <-chan ReconcileEvent
	QueueReconcile()
	ResetRestartBackoff()

	UpdateInputs([]Input) error

	Reader
	Writer
}

Runtime interface as presented to the controller.

type Writer

Writer provides write access to the state.

Only output objects can be written to by the controller.

Directories

Path Synopsis
Package conformance implements tests which verify conformance of the implementation with the spec.
Package conformance implements tests which verify conformance of the implementation with the spec.
Package generic provides implementations of generic controllers.
Package generic provides implementations of generic controllers.
transform
Package transform provides a generic implementation of controller which transforms resources A into resources B.
Package transform provides a generic implementation of controller which transforms resources A into resources B.
Package protobuf provides wrappers/adapters between gRPC service and runtime.Engine.
Package protobuf provides wrappers/adapters between gRPC service and runtime.Engine.
client
Package client provides a wrapper around gRPC Runtime client to present it as controller.Engine interface.
Package client provides a wrapper around gRPC Runtime client to present it as controller.Engine interface.
server
Package server provides a wrapper around controller.Runtime over gRPC.
Package server provides a wrapper around controller.Runtime over gRPC.
Package runtime implements the controller runtime.
Package runtime implements the controller runtime.
dependency
Package dependency implements the dependency handling database.
Package dependency implements the dependency handling database.

Jump to

Keyboard shortcuts

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