workload

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 10 Imported by: 41

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCollectionNotFound = errors.New("collection not found")
View Source
var ErrInvalidWorkload = errors.New("supplied workload is invalid")

Functions

func Validate

func Validate(workload Workload) error

Validate validates an individual workload to ensure that its GVK is for the correct resource.

Types

type Reconciler

type Reconciler interface {
	client.Client

	// attribute exporters and setters
	GetController() controller.Controller
	GetManager() manager.Manager
	GetLogger() logr.Logger
	GetResources(*Request) ([]client.Object, error)
	GetEventRecorder() record.EventRecorder
	GetFieldManager() string
	GetWatches() []client.Object
	SetWatch(client.Object)

	// custom methods which are managed by consumers
	CheckReady(*Request) (bool, error)
	Mutate(*Request, client.Object) ([]client.Object, bool, error)
}

Reconciler acts as a client and state holder of the controller for use within the rconciliation loop.

type Request

type Request struct {
	Context    context.Context
	Workload   Workload
	Collection Workload
	Resources  []client.Object
	Log        logr.Logger
}

Request holds the state of the current reconcile request. This Object can be used to pass state such as context between phases of the controller.

type Workload

type Workload interface {
	client.Object

	GetWorkloadGVK() schema.GroupVersionKind
	GetDependencies() []Workload
	GetDependencyStatus() bool
	GetReadyStatus() bool
	GetPhaseConditions() []*status.PhaseCondition
	GetChildResourceConditions() []*status.ChildResource

	SetReadyStatus(bool)
	SetDependencyStatus(bool)
	SetPhaseCondition(*status.PhaseCondition)
	SetChildResourceCondition(*status.ChildResource)
}

Workload represents a Custom Resource that your controller is watching.

Jump to

Keyboard shortcuts

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