control

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Disabled controller are stopped, hooks are not run.
	Disabled mode = iota
	// Required controllers must start, hooks must succeed.
	Required
	// Optional controllers are Disabled if they can't start, otherwise they are Required.
	Optional
	// Relaxed controllers are Disabled if they can't start, hook failures are not errors.
	Relaxed
	// Default mode is Relaxed.
	Default = Relaxed
)

Variables

This section is empty.

Functions

func Register

func Register(name, description string, c Controller) error

Register registers a new controller.

Types

type Control

type Control interface {
	// StartStopControllers starts/stops all controllers according to configuration.
	StartStopControllers(cache.Cache, client.Client) error
	// PreCreateHooks runs the pre-create hooks of all registered controllers.
	RunPreCreateHooks(cache.Container) error
	// RunPreStartHooks runs the pre-start hooks of all registered controllers.
	RunPreStartHooks(cache.Container) error
	// RunPostStartHooks runs the post-start hooks of all registered controllers.
	RunPostStartHooks(cache.Container) error
	// RunPostUpdateHooks runs the post-update hooks of all registered controllers.
	RunPostUpdateHooks(cache.Container) error
	// RunPostStopHooks runs the post-stop hooks of all registered controllers.
	RunPostStopHooks(cache.Container) error
}

Control is the interface for triggering controller-/domain-specific post-decision actions.

func NewControl

func NewControl() (Control, error)

NewControl creates a new controller-agnostic instance.

type Controller

type Controller interface {
	// Start prepares the controller for resource control/decision enforcement.
	Start(cache.Cache, client.Client) error
	// Stop shuts down the controller.
	Stop()
	// PreCreateHook is the controller's pre-create hook.
	PreCreateHook(cache.Container) error
	// PreStartHook is the controller's pre-start hook.
	PreStartHook(cache.Container) error
	// PostStartHook is the controller's post-start hook.
	PostStartHook(cache.Container) error
	// PostUpdateHook is the controller's post-update hook.
	PostUpdateHook(cache.Container) error
	// PostStopHook is the controller's post-stop hook.
	PostStopHook(cache.Container) error
}

Controller is the interface all resource controllers must implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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