controller

package
v0.6.42 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// Name is used to uniquely identify a Controller in tracing, logging and monitoring. Name is required.
	Name string

	// MaxConcurrentReconciles is the maximum number of concurrent Reconciles which can be run. Defaults to 1.
	MaxConcurrentReconciles int

	// Reconciler is a function that can be called at any time with the ID of an object and
	// ensures that the state of the system matches the state specified in the object.
	Do v1.Reconciler

	// CacheSyncTimeout refers to the time limit set on waiting for cache to sync
	// Defaults to 2 minutes if not set.
	CacheSyncTimeout time.Duration

	// PollJitter defines how much polling jitter should there be when polling for new resources.
	PollJitter time.Duration

	// RecoverPanic indicates whether the panic caused by reconcile should be recovered.
	RecoverPanic *bool

	DeQueueJitter time.Duration
	// contains filtered or unexported fields
}

func (*Controller) LastPollTime

func (c *Controller) LastPollTime() time.Time

LastPollTime returns the last time controller poll was executed. It signals whether the controller is alive and running.

func (*Controller) LastReconcileTime

func (c *Controller) LastReconcileTime() time.Time

LastReconcileTime returns the last time controller poll was executed. It signals whether the controller is alive and running.

func (*Controller) Restart

func (c *Controller) Restart()

func (*Controller) SetupWithManager

func (c *Controller) SetupWithManager(manager *Manager)

func (*Controller) Start

func (c *Controller) Start(ctx context.Context)

Start implements controller.Controller.

type ControllerManagerOption

type ControllerManagerOption func(*Manager) error

func WithCacheSyncTimeout

func WithCacheSyncTimeout(timeout time.Duration) ControllerManagerOption

func WithConsoleClient

func WithConsoleClient(client client.Client) ControllerManagerOption

func WithConsoleClientArgs

func WithConsoleClientArgs(url string, deployToken string) ControllerManagerOption

func WithJitter

func WithJitter(jitter time.Duration) ControllerManagerOption

func WithLivenessCheckInterval

func WithLivenessCheckInterval(interval time.Duration) ControllerManagerOption

func WithMaxConcurrentReconciles

func WithMaxConcurrentReconciles(maxConcurrentReconciles int) ControllerManagerOption

func WithPollInterval

func WithPollInterval(interval time.Duration) ControllerManagerOption

func WithRecoverPanic

func WithRecoverPanic(recoverPanic bool) ControllerManagerOption

func WithSocket

func WithSocket(socket websocket.Socket) ControllerManagerOption

func WithSocketArgs

func WithSocketArgs(clusterID, url, deployToken string) ControllerManagerOption

type Manager

type Manager struct {
	sync.Mutex

	Controllers []*Controller

	// MaxConcurrentReconciles is the maximum number of concurrent Reconciles which can be run.
	MaxConcurrentReconciles int

	// CacheSyncTimeout refers to the time limit set on waiting for cache to sync
	// Defaults to 2 minutes if not set.
	CacheSyncTimeout time.Duration

	// RecoverPanic indicates whether the panic caused by reconcile should be recovered.
	RecoverPanic *bool

	// PollInterval defines how often controllers should poll for new resources.
	PollInterval time.Duration

	// PollJitter defines how much polling jitter should there be when polling for new resources.
	PollJitter time.Duration

	// LivenessCheckInterval recheck the controller liveness.
	LivenessCheckInterval time.Duration

	Socket websocket.Socket
	// contains filtered or unexported fields
}

func NewControllerManager

func NewControllerManager(options ...ControllerManagerOption) (*Manager, error)

func (*Manager) AddController

func (cm *Manager) AddController(ctrl *Controller)

func (*Manager) AddReconcilerOrDie

func (cm *Manager) AddReconcilerOrDie(name string, reconcilerGetter func() (v1.Reconciler, error))

func (*Manager) GetReconcilerOrDie

func (cm *Manager) GetReconcilerOrDie(name string) v1.Reconciler

func (*Manager) Start

func (cm *Manager) Start(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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