operator

package
v0.0.0-...-08ae47d Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package operator implements a Kubernetes controller to reconcile Operator CRD resources.

Package operator implements a Kubernetes controller to reconcile Operator CRD resources.

Index

Constants

View Source
const StatusChannelBufferSize = 64

StatusChannelBufferSize defines the longest backlog on the status channel.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	runtimeManager.Runnable
	reconcile.Reconciler
	GetManager() runtimeManager.Manager
}

func NewController

func NewController(config *rest.Config, options runtimeManager.Options) (Controller, error)

NewController creates a new Kubernetes controller that handles the Operator CRDs.

type Operator

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

func New

func New(name string, mgr runtimeMgr.Manager, spec *opv1a1.OperatorSpec, opts Options) *Operator

New creates a new operator.

func NewFromFile

func NewFromFile(name string, mgr runtimeMgr.Manager, file string, opts Options) (*Operator, error)

NewFromFile creates a new operator from a serialized operator spec.

func (*Operator) AddController

func (op *Operator) AddController(config opv1a1.Controller) error

AddController adds a new controller to the operator.

func (*Operator) GetController

func (op *Operator) GetController(name string) *dcontroller.Controller

GetController returns the controller with the given name or nil if no controller with that name exists.

func (*Operator) GetManager

func (op *Operator) GetManager() runtimeMgr.Manager

GetManager returns the controller runtime manager associated with the operator.

func (*Operator) GetName

func (op *Operator) GetName() string

GetName returns the name of the operator.

func (*Operator) GetStatus

func (op *Operator) GetStatus(gen int64) opv1a1.OperatorStatus

GetStatus populates the operator status with the controller statuses.

func (*Operator) Start

func (op *Operator) Start(ctx context.Context) error

Start starts the operator. It blocks

func (*Operator) Trigger

func (op *Operator) Trigger(err error)

Trigger can be used to ask a status update trigger on the operator.

type Options

type Options struct {
	// ErrorChannel is a channel to receive errors from the operator. Note that the error
	// channel is rate limited to at most 3 errors per every 2 seconds. Use ReportErrors on the
	// individual controllers to get the errors that might have been supporessed by the rate
	// limiter.
	ErrorChannel chan error

	// Logger is a standard logger.
	Logger logr.Logger
}

Options can be used to customize the Operator's behavior.

Jump to

Keyboard shortcuts

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